Angularjs Apply Filter In Controller
I have root controller in my AngularJS web application and filter. Filter works if i apply it in the html template, but it doesn't work if i'm trying to apply filter in the control
Solution 1:
Don't wrap $scope.error_message = filter('ERROR');
in $scope.$apply
- this will cause an error because the Controller is invoked in a digest cycle.
This should work:
functionController ($filter ... other deps ...) {
var filter = $filter('my_filter');
$scope.error_message = filter('ERROR');
}
Post a Comment for "Angularjs Apply Filter In Controller"