What is the use of a filter in AngularJS?

It is used to format the value of the expression to display the output. AngularJS enables us to apply filter. It can be added to expressions by using the pipe character |, followed by a filter.



<div ng-app="myApp" ng-controller="personCtrl">    

<p>The name is {{ firstName | uppercase }}</p>    



angular.module('myApp', []).controller('personCtrl', function($scope) {    

    $scope.firstName = "Umesh",    

    $scope.lastName = "Singh"    



Suggest An Answer

No suggestions avaliable!

Related Interview Questions