Objectives and outcomes

In this tutorial we are going to learn about displaying data in various locale format. In the example we will be displaying data in bulgarian format. Well we can use locale with three filters namely: date, currency and number. To use this we have to include the particular locale-format js file from angular-js package or using CDN links.
For bulgarian format we will link "https://code.angularjs.org/1.2.5/i18n/angular-locale_bg-bg.js" file in our application.



HTML code:

<html>
<head>
<meta charset="utf-8">
<title>AngularJS loale-format</title>
<script src="angular-1.4.6/angular.min.js"></script>
<script src="angular-1.4.6/i18n/angular-locale_bg-bg.js"></script>
</head>
<body>
<div ng-app="locale_app" ng-controller="locale_control">
<p>Money : <b>{{money | currency}}</b><br/>
Date : <b>{{app_date | date}}</b><br/>
Numbers : <b>{{app_num | number}}</b></p>
</div>
</body>
</html>


Javascript

<script>
var app = angular.module("locale_app",[]);
app.controller("locale_control",function($scope)
{
$scope.money = 12000;
$scope.app_date = new Date();
$scope.app_num = 1435.78;
});
</script>


Money : {{money | currency}}
Date : {{app_date | date}}
Numbers : {{app_num | number}}



There are more than 25 locale-format js files inside i18n folder.