This repository was archived by the owner on Dec 4, 2017. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
public/docs/_examples/homepage-todo/ts/app Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change 1
1
// #docregion
2
2
import { Component } from 'angular2/core' ;
3
- import { Todo } from './todo' ;
4
- import { TodoList } from './todo_list' ;
5
- import { TodoForm } from './todo_form' ;
3
+ import { Todo } from './todo' ;
4
+ import { TodoList } from './todo_list' ;
5
+ import { TodoForm } from './todo_form' ;
6
6
7
7
@Component ( {
8
8
selector : 'todo-app' ,
@@ -18,19 +18,19 @@ import {TodoForm} from './todo_form';
18
18
} )
19
19
export class TodoApp {
20
20
todos : Todo [ ] = [
21
- { text :'learn angular' , done :true } ,
22
- { text :'build an angular app' , done :false }
21
+ { text : 'learn angular' , done : true } ,
22
+ { text : 'build an angular app' , done : false }
23
23
] ;
24
24
25
25
get remaining ( ) {
26
- return this . todos . reduce ( ( count : number , todo : Todo ) => count + + ! todo . done , 0 ) ;
26
+ return this . todos . filter ( todo => ! todo . done ) . length ;
27
27
}
28
28
29
29
archive ( ) : void {
30
- var oldTodos = this . todos ;
30
+ let oldTodos = this . todos ;
31
31
this . todos = [ ] ;
32
- oldTodos . forEach ( ( todo : Todo ) => {
33
- if ( ! todo . done ) this . todos . push ( todo ) ;
32
+ oldTodos . forEach ( todo => {
33
+ if ( ! todo . done ) { this . todos . push ( todo ) ; }
34
34
} ) ;
35
35
}
36
36
You can’t perform that action at this time.
0 commit comments