From 2d92e7066efd83ea0d9fb17b83db35f799f71146 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Fri, 26 Jul 2013 01:52:57 +0200 Subject: [PATCH] Remove ternary expressions A more readable and scalable approach --- .../angularjs-perf/js/controllers/todoCtrl.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/architecture-examples/angularjs-perf/js/controllers/todoCtrl.js b/architecture-examples/angularjs-perf/js/controllers/todoCtrl.js index 3c9db5c851..df1da019e6 100644 --- a/architecture-examples/angularjs-perf/js/controllers/todoCtrl.js +++ b/architecture-examples/angularjs-perf/js/controllers/todoCtrl.js @@ -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) {