From 9370113b9d01c53f80a2adf298caa95a735f75cd Mon Sep 17 00:00:00 2001 From: Samuli Ulmanen Date: Wed, 6 Apr 2016 09:10:52 +0300 Subject: [PATCH] docs(todo app): replace remaining tasks reduce func with filter.length closes #1050 --- .../_examples/homepage-todo/ts/app/todo_app.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/public/docs/_examples/homepage-todo/ts/app/todo_app.ts b/public/docs/_examples/homepage-todo/ts/app/todo_app.ts index 5688868b73..ca444d4ef6 100644 --- a/public/docs/_examples/homepage-todo/ts/app/todo_app.ts +++ b/public/docs/_examples/homepage-todo/ts/app/todo_app.ts @@ -1,8 +1,8 @@ // #docregion import {Component} from 'angular2/core'; -import {Todo} from './todo'; -import {TodoList} from './todo_list'; -import {TodoForm} from './todo_form'; +import {Todo} from './todo'; +import {TodoList} from './todo_list'; +import {TodoForm} from './todo_form'; @Component({ selector: 'todo-app', @@ -18,19 +18,19 @@ import {TodoForm} from './todo_form'; }) export class TodoApp { todos: Todo[] = [ - {text:'learn angular', done:true}, - {text:'build an angular app', done:false} + {text: 'learn angular', done: true}, + {text: 'build an angular app', done: false} ]; get remaining() { - return this.todos.reduce((count: number, todo: Todo) => count + +!todo.done, 0); + return this.todos.filter(todo => !todo.done).length; } archive(): void { - var oldTodos = this.todos; + let oldTodos = this.todos; this.todos = []; - oldTodos.forEach((todo: Todo) => { - if (!todo.done) this.todos.push(todo); + oldTodos.forEach(todo => { + if (!todo.done) { this.todos.push(todo); } }); }