Friday, February 19, 2016

AngularJS Filters ( | )

Filters are used to transform the data in desired formats. Angular provides many builtin filters (json, orderby, uppercase,currency,date and filter etc.) and we can define our own filters as well depending on requirements.

Filters can be used to an expression by using '|' followed by the filter.

<body>

<div ng-app="myApp" ng-controller="formatCtrl">
Amount : {{ amount | currency }}
</div>

<script>
var app = angular.module('myApp', []);
app.controller('formatCtrl', function($scope) {
    $scope.amount = 14523.2;
});
</script>

</body>

No comments:

Post a Comment