8000 todo app remaining tasks reducer func fixed and clarified by sulmanen · Pull Request #1050 · angular/angular.io · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

todo app remaining tasks reducer func fixed and clarified #1050

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
filter is better suited to get todo app remaining count
  • Loading branch information
Samuli Ulmanen committed Apr 6, 2016
commit f844c02404088e855d4a36cd32f882d0b044d3d6
2 changes: 1 addition & 1 deletion public/docs/_examples/homepage-todo/ts/app/todo_app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class TodoApp {
];

get remaining() {
return this.todos.reduce((count: number, todo: Todo) => todo.done ? count : ++count, 0);
return this.todos.filter((todo: Todo) => !todo.done).length;
}

archive(): void {
Expand Down
0