Created
September 26, 2014 12:39
-
-
Save gajus/5ee40130f3a2409362b1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular | |
.module('store') | |
.constant('productListActiveClass', 'active') | |
.controller('productListController', function ($scope, $filter, productListActiveClass) { | |
var selectedCategory = null; | |
$scope.selectCategory = function (categoryName) { | |
selectedCategory = categoryName; | |
}; | |
$scope.categoryFilterFn = function (product) { | |
return !selectedCategory || product.category === selectedCategory; | |
}; | |
$scope.getCategoryClass = function (categoryName) { | |
return categoryName == selectedCategory ? productListActiveClass : ''; | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment