ng-bind-html不处理INPUT

时间:2014-01-13 14:59:15

标签: javascript html angularjs

我想将html与$scope.value = "<input type=text name=a>"

的内容绑定

在DOM中没有插入任何内容,但如果$scope.value = "Hello <i>Guys</i>"一切正常。

ng-bind-html是否存在限制/错误?有解决方法吗?

我正在使用1.2.4版本的angularJS

感谢您的帮助,这对我的开发来说是个大问题

克里斯托弗

1 个答案:

答案 0 :(得分:-1)

你不能使用指令代替那个吗?这样我觉得你摆脱了你的问题

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
  }
});