Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • AngularJs Filter

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 281
    Comment on it

    When we want to format data in angularJS then we use filter.There are n number of filter available in angularJS which is used to transform data. AngularJS filter are:


    1) Currency: Which will format a number to a currency format.
    2) date:Which will format a date to a specified format.
    3) filter:Select a subset of items from an array.
    4) lowercase:Format a string to lower case.
    5) uppercase:Format a string to upper case.

     

    Example:

    <!DOCTYPE html>
    <html>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
    <body>
    
    <div ng-app="myAppFilter" ng-controller="personCtrl">
    
    <p>My name is {{ lastName | uppercase }}</p>
    
    </div>
    
    <script>
    angular.module('myAppFilter', []).controller('personCtrl', function($scope) {
        $scope.firstName = "Ankit",
        $scope.lastName = "Bhatia"
    });
    </script>
    
    </body>
    </html>

     

    Here In the example we can see ng-app is a directives where we can define our application name and we have implement uppercase filter in the above example.

 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: