- ng-repeat
- ng-click
TODO with AngularJS
examples/angular/todo1.html
<script src="angular.min.js"></script> <script src="todo1.js"></script> <div ng-app="todoApp" ng-controller="todoController"> <input ng-model="title"><button ng-click="add()">Add</button> <ul> <li ng-repeat="t in tasks">{{ t }}</li> </ul> </div>
examples/angular/todo1.js
angular.module('todoApp', []) .controller('todoController', ['$scope', function($scope) { $scope.tasks = []; $scope.add = function() { $scope.tasks.push($scope.title); } }]);
- ENTER does not work
- Reload removes data