- <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>
- angular.module('todoApp', [])
- .controller('TodoListController', function() {
- todoList.addTodo = function() {
- todoList.todos.push({text:todoList.todoText, done:false});
- todoList.todoText = '';
- todoList.remaining = function() {
- angular.forEach(todoList.todos, function(todo) {
- count += todo.done ? 0 : 1;
- todoList.archive = function() {
- var oldTodos = todoList.todos;
- angular.forEach(oldTodos, function(todo) {
- if (!todo.done) todoList.todos.push(todo);
- <div ng-controller="TodoListController as todoList">
- <span>{{todoList.todos.length}}個中、{{todoList.remaining()}}個のTODOが残っています。</span>
- [ <a href="" ng-click="todoList.archive()">アーカイブ</a> ]
- <li ng-repeat="todo in todoList.todos">
- <input type="checkbox" ng-model="todo.done">
- <span class="done-{{todo.done}}">{{todo.text}}</span>
- <form ng-submit="todoList.addTodo()">
- <input type="text" ng-model="todoList.todoText" size="30" placeholder="新しいTODO">
- <input class="btn-primary" type="submit" value="追加">
+ <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>
+ angular.module('todoApp', [])
+ .controller('TodoListController', function() {
+ todoList.addTodo = function() {
+ todoList.todos.push({text:todoList.todoText, done:false});
+ todoList.todoText = '';
+ todoList.remaining = function() {
+ angular.forEach(todoList.todos, function(todo) {
+ count += todo.done ? 0 : 1;
+ todoList.archive = function() {
+ var oldTodos = todoList.todos;
+ angular.forEach(oldTodos, function(todo) {
+ if (!todo.done) todoList.todos.push(todo);
+ <div ng-controller="TodoListController as todoList">
+ <span>{{todoList.todos.length}}個中、{{todoList.remaining()}}個のTODOが残っています。</span>
+ [ <a href="" ng-click="todoList.archive()">アーカイブ</a> ]
+ <li ng-repeat="todo in todoList.todos">
+ <input type="checkbox" ng-model="todo.done">
+ <span class="done-{{todo.done}}">{{todo.text}}</span>
+ <form ng-submit="todoList.addTodo()">
+ <input type="text" ng-model="todoList.todoText" size="30" placeholder="新しいTODO">
+ <input class="btn-primary" type="submit" value="追加">