
- AngularJS Tutorial
- AngularJS - Home
- AngularJS - Overview
- AngularJS - Environment Setup
- AngularJS - MVC Architecture
- AngularJS - First Application
- AngularJS - Directives
- AngularJS - Expressions
- AngularJS - Controllers
- AngularJS - Filters
- AngularJS - Tables
- AngularJS - HTML DOM
- AngularJS - Modules
- AngularJS - Forms
- AngularJS - Includes
- AngularJS - AJAX
- AngularJS - Views
- AngularJS - Scopes
- AngularJS - Services
- AngularJS - Dependency Injection
- AngularJS - Custom Directives
- AngularJS - Internationalization
- AngularJS Applications
- AngularJS - ToDo Application
- AngularJS - Notepad Application
- AngularJS - Bootstrap Application
- AngularJS - Login Application
- AngularJS - Upload File
- AngularJS - In-line Application
- AngularJS - Nav Menu
- AngularJS - Switch Menu
- AngularJS - Order Form
- AngularJS - Search Tab
- AngularJS - Drag Application
- AngularJS - Cart Application
- AngularJS - Translate Application
- AngularJS - Chart Application
- AngularJS - Maps Application
- AngularJS - Share Application
- AngularJS - Weather Application
- AngularJS - Timer Application
- AngularJS - Leaflet Application
- AngularJS - Lastfm Application
- AngularJS Useful Resources
- AngularJS - Questions and Answers
- AngularJS - Quick Guide
- AngularJS - Useful Resources
- AngularJS - Discussion
AngularJS - Internationalization
AngularJS supports inbuilt internationalization for three types of filters : Currency, Date, and Numbers. We only need to incorporate corresponding java script according to locale of the country. By default, it considers the locale of the browser. For example, for Danish locale, use the following script −
<script src = "https://code.angularjs.org/1.2.5/i18n/angular-locale_da-dk.js"> </script>
Example Using Danish Locale
testAngularJS.htm
<html> <head> <title>Angular JS Forms</title> </head> <body> <h2>AngularJS Sample Application</h2> <div ng-app = "mainApp" ng-controller = "StudentController"> {{fees | currency }} <br/><br/> {{admissiondate | date }} <br/><br/> {{rollno | number }} </div> <script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"> </script> <script src = "https://code.angularjs.org/1.3.14/i18n/angular-locale_da-dk.js"> </script> <script> var mainApp = angular.module("mainApp", []); mainApp.controller('StudentController', function($scope) { $scope.fees = 100; $scope.admissiondate = new Date(); $scope.rollno = 123.45; }); </script> </body> </html>
Output
Open the file testAngularJS.htm in a web browser and see the result.
Example Using Browser Locale
testAngularJS.htm
<html> <head> <title>Angular JS Forms</title> </head> <body> <h2>AngularJS Sample Application</h2> <div ng-app = "mainApp" ng-controller = "StudentController"> {{fees | currency }} <br/><br/> {{admissiondate | date }} <br/><br/> {{rollno | number }} </div> <script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"> </script> <!-- <script src = "https://code.angularjs.org/1.3.14/i18n/angular-locale_da-dk.js"> </script> --> <script> var mainApp = angular.module("mainApp", []); mainApp.controller('StudentController', function($scope) { $scope.fees = 100; $scope.admissiondate = new Date(); $scope.rollno = 123.45; }); </script> </body> </html>
Output
Open the file testAngularJS.htm in a web browser and see the result.
Advertisements
To Continue Learning Please Login