Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to make currency Filter in AngularJS .

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 491
    Comment on it

    With the help of AngularJS Filters method we create a currency filter function. In below example, We will first input two text box then we will declare first price of an article, after then will input quantity of article and finally get total price of an article.

    <!DOCTYPE html>
    <html>
    <script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
    <body>
    
    <div ng-app="myApp" ng-controller="costCtrl">
    
    Article: <input type="number" ng-model="quantity">
    Price: <input type="number" ng-model="price">
    
    <p>Total = {{ (quantity * price) | currency }}</p>
    
    </div>
    
    <script>
    var app = angular.module('myApp', []);
    app.controller('costCtrl', function($scope) {
        $scope.quantity = 1;
        $scope.price = 5.99;
    });
    </script>
    
    </body>
    </html>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: