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 11// #docregion
22import { 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' ;
66
77@Component ( {
88 selector : 'todo-app' ,
@@ -18,19 +18,19 @@ import {TodoForm} from './todo_form';
1818} )
1919export class TodoApp {
2020 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 }
2323 ] ;
2424
2525 get remaining ( ) {
26- return this . todos . reduce ( ( count : number , todo : Todo ) => count + + ! todo . done , 0 ) ;
26+ return this . todos . filter ( todo => ! todo . done ) . length ;
2727 }
2828
2929 archive ( ) : void {
30- var oldTodos = this . todos ;
30+ let oldTodos = this . todos ;
3131 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 ) ; }
3434 } ) ;
3535 }
3636
You can’t perform that action at this time.
0 commit comments