我需要改变HTML动态的郎
属性一些帮助:
I need some help for change dynamically the lang
attribute of HTML:
<html lang="en">
我正在与AngularJS和休息后端多语言的Web应用程序。起初我可以指定一个默认的郎
属性,但我想它根据用户的浏览器,或者如果用户在Web应用程序中选择一些语言选项改变它来改变。
I'm making a multilanguage web application with AngularJS and rest backend.
Initially I can specify a default lang
attribute, but I want to change it depending on the user browser or change it if the user selects inside the web application some language option.
有一些方法来做到这一点?
There is some way to do it?
如果要动态更改语言。只是,你可以在一个控制器
添加到HTML标记,然后更改语言。
If you want to change the language dynamically. simply you can add one controller
to html tag and then change the language.
试试这个:
<html ng-app="langChange" ng-controller="langCtrl" lang={{lang}}>
</html>
JS code:
var app = angular.module(langChange,[]);
app.controller("langCtrl",[$scope,function($scope){
$scope.lang = "en";//here you can change the language dynamically
}])
上一篇:防爆preSS + AngularJS + HTML:NG-包括不工作(404 - 找不到页错误)找不到、错误、工作、AngularJS
下一篇:AngularJS - 拖动和多个连接sortables(jQuery用户界面+角常见)多个、拖动、用户界面、常见