1. Trang chủ
  2. » Thể loại khác

Đa ngôn ngữ (i18n) trong AngularJS | 26 bài hướng dẫn AngularJs miễn phí PDF

3 272 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 3
Dung lượng 331,64 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

AngularJS - Các chức năng quốc tế hóa AngularJS cung cấp sẵn các chức năng quốc tế hóa với 3 kiểu filter là currency, date và number.. Chúng ta chỉ cần kết hợp đoạn js tương ứng với theo

Trang 1

AngularJS - Các chức năng quốc tế hóa AngularJS cung cấp sẵn các chức năng quốc tế hóa với 3 kiểu filter là currency, date và number Chúng ta chỉ cần kết hợp đoạn js tương ứng với theo vị trí tùy Quốc gia Mặc định nó sẽ gắn với ví trị trong trình duyệt web Ví dụ, khi sử dụng ví trí ở Đan Mạch, bạn sử dụng đoạn script sau đây:

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

testAngularJS.jsp

<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.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>

Trang 2

</body>

</html>

Mở trang textAngularJS.jsp trong một trình duyệt web và xem kết quả

testAngularJS.jsp

<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.3.14/angular.min.js"></script>

<! <script src="https://code.angularjs.org/1.3.14/i18n/angular-locale_da-dk.js"></script> >

<script>

Trang 3

var mainApp = angular.module("mainApp", []);

mainApp.controller('StudentController', function($scope) {

$scope.fees = 100;

$scope.admissiondate = new Date();

$scope.rollno = 123.45;

});

</script>

</body>

</html>

Mở trang textAngularJS.jsp trong một trình duyệt web và xem kết quả

Ngày đăng: 02/12/2017, 18:52

TỪ KHÓA LIÊN QUAN