Converting numbers to currency pipe feature and set currency symbol.
Formatting a number as a currency (ie $1,234.56). When no currency symbol is provided, default symbol for current locale is used
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
<script>
angular.module('myApp',[])
.controller('AngController',function($scope) {
$scope.dataSet = [
{Name:'Keyboard',Price:90},
{Name:'Mouse',Price:150},
{Name:'Monitor',Price:3500},
{Name:'Pen Drive',Price:550},
{Name:'Wifi Dongle',Price:600},
{Name:'Blue Tooth',Price:300}
];
$scope.myData = $scope.dataSet[0];
});
</script>
</head>
<body ng-app="myApp">
<div ng-controller="AngController">
<ul>
<li ng-repeat="data in dataSet">{{data.Name}} - {{data.Price | currency : "Rs.":0}}</li>
</ul>
</div>
</body>
</html>
Demo :
- {{data.Name}} - {{data.Price | currency : "Rs.":0}}
No comments:
Post a Comment