Skip to content
This repository has been archived by the owner on Mar 22, 2022. It is now read-only.

chenxiaoyao6228/angular-tiny

Repository files navigation

Angular-tiny

Angular-tiny是一个类AngularJS的迷你框架, 实现了双向数据绑定,模板解析, 组件化等前端框架必备的部分,同时内置了HTTP服务等模块,方便开发者.

⚠ 此项目仅作为个人探究前端框架学习的总结,不建议在生产环境中的使用

快速上手

安装

yarn add angular-tiny

实现基本的counter app

html部分

<!DOCTYPE html>
<html>
<head>
</head>
<body ng-app="myCounterApp">
  <div ng-controller="CounterController as ctrl">
    {{ctrl.counter}}
    <button ng-click="ctrl.increment()">+</button>
    <button ng-click="ctrl.decrement()">-</button>
  </div>
  <script src="../dist/angular-tiny.js"></script>
  <script src="counter.js"></script>
</body>
</html>

js部分

angular.module('myCounterApp', []).controller('CounterController', function() {
  this.counter = 1
  this.increment = function() {
    this.counter++
  }
  this.decrement = function() {
    this.counter--
  }
})

Done/Todo

  • scope继承
  • 依赖注入系统
  • Promise服务模块
  • Http服务模块
  • 指令,插值绑定及组件化
  • ngModel, ngSwitch等指令
  • 路由模块

参考资料

  • build-your-own-angularJS

  • Javascript框架设计

About

An Angular-like framework, build with TDD

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published