The following code shows how to create. Custom filter with parameters.
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
<script type='text/javascript'>
<!--from ww w . j a v a 2 s . c o m-->
angular.module('myApp', []).filter('exactString', function () {
return function (string, term) {
return ('' + string).indexOf(term) > -1;
}
}).controller("myAppCtrl", function ($scope) {
$scope.willMatch = "shipped";
$scope.willNotMatch = "Partially Shipped";
});
</script>
</head>
<body ng-app="myApp">
<div ng-controller="myAppCtrl">
{{willMatch | exactString:'shipped'}}
{{willNotMatch |exactString:'shipped'}}
</div>
</body>
</html>
The code above is rendered as follows: