डाउनलोड पी.डी.एफ. ई-बुक्स
AJS - Filters filter

filter ये filter; दिए गए array से दिए गए matching elements को array में return करता है |

Syntax for Filter Filter in AngularJS

{{expression | filter : compareChar}}

Parameter for Filter Filter in AngularJS

compareChar : यहाँ पर array से match करने के लिए character(s) दिया जाता है |


Example for filter Filter in AngularJS

Source Code :
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
</head>
<body>

<div ng-app="app" ng-controller="ctrl">
'am' Matches : {{arr | filter : 'am'}}<br />
</div>

<script>
var myapp = angular.module("app", []);
myapp.controller("ctrl", function($scope){
	$scope.arr = ['Ramesh', 'Mukesh', 'Kamlesh', 'Anu', 'Alok']
});
</script>

</body>
</html>
Output :
'am' Matches : ["Ramesh","Kamlesh"]

Another Example for filter Filter in AngularJS

Source Code :
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
</head>
<body>

<div ng-app="app" ng-controller="ctrl">
<input ng-model="search"><br />
{{arr | filter : search}}
</div>

<script>
var myapp = angular.module("app", []);
myapp.controller("ctrl", function($scope){
	$scope.arr = ['Ramesh', 'Mukesh', 'Kamlesh', 'Anu', 'Alok']
});
</script>

</body>
</html>
Output :

{{arr | filter : search}}