我想将html与$scope.value = "<input type=text name=a>"的内容绑定在一起
没有任何东西被插入到DOM中,但是如果使用$scope.value = "Hello <i>Guys</i>",一切都是正常的。
ng-bind-html是否有限制/bug?有解决办法吗?
我使用的是1.2.4版本的angularJS
谢谢你的帮助,这对我的发展来说是个大问题
克里斯托弗
发布于 2014-01-14 00:25:39
你不能用一个指令来代替它吗?这样我想你就摆脱了你的问题
http://docs.angularjs.org/guide/directive
https://egghead.io/search?q=directive
下面是一个小示例:
angular.module('myApp').directive('myDirective', function(){
return {
restrict: 'E',
replace: true,
// you can set 'transclude: true' instead of the following line to create a new scope but inheriting from the parent
scope: false, // this will make the directive have the same scope as the parent
templateUrl: 'my-html-template.html'// you can load the template like this
// You can also use 'template' and include the html code here
}
});https://stackoverflow.com/questions/21094362
复制相似问题