Angularjs ng bind不显示作用域变量{{}

Angularjs ng bind不显示作用域变量{{},angularjs,Angularjs,test.html(我的模板): 但是,这会导致页面跨度出现以下情况: Confirmation email sent to {{resetPasswordEmail}}, check your email. 我正在尝试使用“嵌套”范围变量。我必须重新编译编译过的模板吗或者是否有合适的angularjs方法来实现这一点。根据您更新的问题,我明白您为什么要这样做 做到这一点的关键是使用: angular.module('app',[])。 控制器('Ctrl',函数($scope,$inte

test.html(我的模板):

但是,这会导致页面跨度出现以下情况:

Confirmation email sent to {{resetPasswordEmail}}, check your email. 

我正在尝试使用“嵌套”范围变量。我必须重新编译编译过的模板吗或者是否有合适的angularjs方法来实现这一点。

根据您更新的问题,我明白您为什么要这样做

做到这一点的关键是使用:

angular.module('app',[])。
控制器('Ctrl',函数($scope,$interpolate,$compile){
$scope.resetPasswordEmail=”my@email.here";
$scope.emailSent={
信息:$interpolate(getInfoFromDatabase())($scope)
};
函数getInfoFromDatabase(){
return“确认电子邮件已发送至{{resetPasswordEmail}},请检查您的电子邮件。”
}
元素(document.body).append($compile(“”)($scope));
})


完美!我知道AngularJS能做到这一点+以1为例,谢谢!对不起,一开始我不明白你在做什么。:)
$scope.resetPasswordEmail = "my@email.here";
// info is taken from a database with different languages
$scope.emailSent = { 
    info: getInfoFromDatabase() // returns: 'Confirmation email sent to {{resetPasswordEmail}}, check your email.'
};
angular.element(document.body).append($compile($templateCache.get('test.html'))($scope));
Confirmation email sent to {{resetPasswordEmail}}, check your email.