AngularJs currency Filter

AngularJs filters are concepts that work with separation of record based on column and in angular filters, we added expressions and directives by using the pipe (|) character. 

This is number currency filer.

This filter is use to display the currency items and going to display currency(number etc.) items in UX using the number currency which are given in detail below.

//The currency syntax:

<div>{{yourPrice| yourCurrency}}</div> 

//AngularJs code sample as given below.

var app = angular.module('filtersApp', []);
app.controller('filtersCtrl', function ($scope) {
     $scope.salary = 10000;
});

//HTML code sample as given below.

<div ng-app="filtersApp">
    <div>
        <h1>Currency Filter</h1>
    </div>
    <div ng-controller="filtersCtrl">
        <h4>{{salary | currency}}</h4>
        <h4>{{-salary | currency}}</h4>
    </div>
</div>

//The full example code with live demo as given below.

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="utf-8">
    <title>Formatting Filters</title>
    <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js"></script>
    <script>
        var app = angular.module('filtersApp', []);

        app.controller('filtersCtrl', function ($scope) {
            $scope.salary = 10000;
        });
    </script>
</head>
<body ng-app="filtersApp">
    <div>
        <h1>Currency Filter</h1>
    </div>
    <div ng-controller="filtersCtrl">
        <h4>{{salary | currency}}</h4>
        <h4>{{-salary | currency}}</h4>
    </div>
</body>
</html>


The Output as below,

About Blogger

ANIL SINGH

Hey! I am Anil Singh. I am Active Blogger, Writer and Programmer. I love learning new technologies, programming, blogging and participating the forum discussions more...
http://www.code-sample.com
http://www.code-sample.xyz

    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment

SQL Server NodeJs TypeScript JavaScript Angular SQL Server My Book