I've been using filters as seen here http://fiddle.jshell.net/NLcxL/5/ for
a while now. The app I'm working on has many of filters very much like this.
$scope.checkedEyeColor = {};
var showAllEyeColor = true;
$scope.filterEyeColor = function(result){
return showAllEyeColor || $scope.checkedEyeColor[result.eyeColor];
};
$scope.$watch('checkedEyeColor', function(newval, oldval) {
showAllEyeColor = true;
angular.forEach($scope.checkedEyeColor, function(val) {
if( val === true ) showAllEyeColor = false;
});
}, true);
Because I have all these in my controller file it is getting a bit
unmanageable, so I was wondering how best to separate each filter out into
its own filter js file, and then I believe I can write a test for each one?
I know Angular has it's own .filter but I'm not having much luck.
This is where I'm up to my a custom filter: fiddle.jshell.net/6F6FH/1 (not
very far :P )
Cheers Tom
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.