Skip to content

Commit

Permalink
Remove ternary expressions
Browse files Browse the repository at this point in the history
A more readable and scalable approach
  • Loading branch information
glebm committed Jul 25, 2013
1 parent 26bdbb2 commit 2d92e70
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ todomvc.controller('TodoCtrl', function TodoCtrl($scope, $location, todoStorage,
$scope.location = $location;

$scope.$watch('location.path()', function (path) {
$scope.statusFilter = (path === '/active') ?
{ completed: false } : (path === '/completed') ?
{ completed: true } : null;
$scope.statusFilter = { '/active': {completed: false}, '/completed': {completed: true} }[path];
});

$scope.$watch('remainingCount == 0', function (val) {
Expand Down

0 comments on commit 2d92e70

Please sign in to comment.