Aug 3, 2015

Filters Angular Js

Filters are used to format data before displaying it to the user. They can be used in view templates, controllers, services and directives. There are some built-in filters provided by AngularJS like as Currency, Date, Number, OrderBy, Lowercase, Uppercase etc. You can also create your own filters.

<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script>
<title>AngularJS Filters</title>
</head>
<body ng-app="app">
<div ng-controller="Ctrl">
  <p>Total Price: <span ng-bind="quantity * price | currency:'₹'"></span></p>
 
  <p>Full Name: <span ng-bind="firstName + ' ' + lastName | uppercase"></span></p>
</div>
 
<script>
  var app=angular.module("app",[]);
   
  app.controller('Ctrl',function($scope){
      $scope.quantity=5;
      $scope.price=10;
     
      $scope.firstName="Shailendra";
      $scope.lastName="Chauhan";
  });
</script>
</body>
</html>



Total Price: ₹50.00
Full Name: SHAILENDRA CHAUHAN

No comments:

Post a Comment