Angularjs ng绑定html数据+;变量正确语法

Angularjs ng绑定html数据+;变量正确语法,angularjs,Angularjs,我找不到办法来处理这件事。。。 我正在使用ng bind html从数据库加载文本。我想向几种语言中的一种添加一个变量​​. 但我不理解正确的语法。 我想用这样的东西: <div ng-bind-html="detail.txt+lang"></div> //inside the controller for the view $scope.writeValueFromDb = function() { //here you can access the $ro

我找不到办法来处理这件事。。。 我正在使用ng bind html从数据库加载文本。我想向几种语言中的一种添加一个变量​​. 但我不理解正确的语法。 我想用这样的东西:

<div ng-bind-html="detail.txt+lang"></div>
//inside the controller for the view
$scope.writeValueFromDb = function() {
    //here you can access the $rootScope
    //(after including it as a dependency in the controller)
    //and from the $rootScope object you can access the language variable
}

其中lang是一个rootScope变量(“_-en”、“_-it”等等)
谢谢

我会这样做:

<div ng-bind-html="detail.txt+lang"></div>
//inside the controller for the view
$scope.writeValueFromDb = function() {
    //here you can access the $rootScope
    //(after including it as a dependency in the controller)
    //and from the $rootScope object you can access the language variable
}
这样,您就不必在视图中绑定的每个方法中手动从
$rootScope
传递语言变量

在视图中,您可以正常绑定它:

<div ng-bind-html="writeValueFromDb()"></div>

显示您的代码。最好是一个小例子,再现您的问题,并说明您所做的尝试。