舉例簡(jiǎn)介AngularJS的內(nèi)部語(yǔ)言環(huán)境
AngularJS支持內(nèi)置的國(guó)際化三種類型的過(guò)濾器貨幣,日期和數(shù)字。只需要根據(jù)國(guó)家的區(qū)域納入相應(yīng)的JS。默認(rèn)情況下它處理瀏覽器的語(yǔ)言環(huán)境。例如,要使用丹麥語(yǔ)的語(yǔ)言環(huán)境,使用下面的腳本
<script src="https://code.angularjs.org/1.2.5/i18n/angular-locale_da-dk.js"></script>
使用丹麥語(yǔ)的語(yǔ)言環(huán)境實(shí)例
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>
結(jié)果
在Web瀏覽器打開(kāi)textAngularJS.html??吹浇Y(jié)果如下。
使用瀏覽器的語(yǔ)言環(huán)境示例
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>
結(jié)果
在Web瀏覽器打開(kāi)textAngularJS.html??吹浇Y(jié)果如下。
相關(guān)文章
AngularJS實(shí)現(xiàn)與后臺(tái)服務(wù)器進(jìn)行交互的示例講解
今天小編就為大家分享一篇AngularJS實(shí)現(xiàn)與后臺(tái)服務(wù)器進(jìn)行交互的示例講解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2018-08-08詳解在 Angular 項(xiàng)目中添加 clean-blog 模板
本篇文章主要介紹了詳解在 Angular 項(xiàng)目中添加 clean-blog 模板,非常具有實(shí)用價(jià)值,需要的朋友可以參考下2017-07-07AngularJS ng-bind-html 指令詳解及實(shí)例代碼
本文主要是對(duì)AngularJS ng-bind-html 指令知識(shí)的詳細(xì)講解,并附代碼實(shí)例,有需要的小伙伴可以參考下2016-07-07Angular2中如何使用ngx-translate進(jìn)行國(guó)際化
本篇文章主要介紹了Angular2中使用ngx-translate進(jìn)行國(guó)際化,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-05-05探討AngularJs中ui.route的簡(jiǎn)單應(yīng)用
這篇文章主要介紹了AngularJs中ui.route的簡(jiǎn)單應(yīng)用,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2016-11-11angularJS 發(fā)起$http.post和$http.get請(qǐng)求的實(shí)現(xiàn)方法
本篇文章主要介紹了angularJS 發(fā)起$http.post和$http.get請(qǐng)求的實(shí)現(xiàn)方法,分別介紹了$http.post和$http.get請(qǐng)求的方法,有興趣的可以了解一下2017-05-05