Commit 019057d0 authored by Pascal Hartig's avatar Pascal Hartig

AngularJS: filterFilter -> $filter('filter')

parent 1609cb02
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* - exposes the model to the template and provides event handlers * - exposes the model to the template and provides event handlers
*/ */
angular.module('todomvc') angular.module('todomvc')
.controller('TodoCtrl', function TodoCtrl($scope, $routeParams, todoStorage, filterFilter) { .controller('TodoCtrl', function TodoCtrl($scope, $routeParams, $filter, todoStorage) {
'use strict'; 'use strict';
var todos = $scope.todos = todoStorage.get(); var todos = $scope.todos = todoStorage.get();
...@@ -15,7 +15,7 @@ angular.module('todomvc') ...@@ -15,7 +15,7 @@ angular.module('todomvc')
$scope.editedTodo = null; $scope.editedTodo = null;
$scope.$watch('todos', function (newValue, oldValue) { $scope.$watch('todos', function (newValue, oldValue) {
$scope.remainingCount = filterFilter(todos, { completed: false }).length; $scope.remainingCount = $filter('filter')(todos, { completed: false }).length;
$scope.completedCount = todos.length - $scope.remainingCount; $scope.completedCount = todos.length - $scope.remainingCount;
$scope.allChecked = !$scope.remainingCount; $scope.allChecked = !$scope.remainingCount;
if (newValue !== oldValue) { // This prevents unneeded calls to the local storage if (newValue !== oldValue) { // This prevents unneeded calls to the local storage
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment