An introduction to ANGULARJS's internal language environment

Source: Internet
Author: User
Tags i18n locale min


This article mainly introduces the internal language environment of ANGULARJS, shows the influence of different language environment on the text of currency or date, and the friends who need it can refer to



ANGULARJS supports the built-in internationalization of three types of filter currencies, dates and numbers. Only need to according to the country's region into the corresponding JS. It handles the browser's locale by default. For example, to use the Danish locale, use the following script




<script src= "Https://code.angularjs.org/1.2.5/i18n/angular-locale_da-dk.js" ></script>


Example of a locale using the Danish language



Testangularjs.html




<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="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script>
 <script src="https://code.angularjs.org/1.2.5/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>



Results



Open textangularjs.html in a Web browser. See the results below.



Examples of language environments using browsers



Testangularjs.html



<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="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script>
 <!-- <script src="https://code.angularjs.org/1.2.5/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>



Results



Open textangularjs.html in a Web browser. See the results below.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.