3
我正在玩angular.js並嘗試學習ng-bind和ng-bind-html。ng-bind-html和angular.js錯誤
首先,我的代碼:
<div ng-app="module" ng-controller="controller as ctrl">
<div ng-bind-html="ctrl.html"></div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular-sanitize.js"></script>
<script>
var themodule = angular.module("module", ["ngSanitize"]);
themodule.controller("controller", [function()
{
this.html = "<strong>Hello</strong><div>More</div>";
}
]);
</script>
即使它的工作原理,在控制檯中出現以下錯誤:
Error: c.push is not a function
yc/this.$get</D.$$addBindingInfo<@https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:73:319
$d</<.compile/<@https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:214:329
[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:70:197
[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:59:255
[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:51:335
[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:59:199
[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:51:335
D/<@https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:50:444
uc/d/</<@https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:18:4
Pe/this.$get</[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:126:11
Pe/this.$get</[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:126:236
uc/d/<@https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:17:477
[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:36:313
uc/[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:17:1
[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:18:179
[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:17:1
@https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:250:429
[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:164:283
lf/[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:32:384
<div class="ng-binding" ng-bind-html="ctrl.html">
我搜查,但我無法找到任何關於它。
有誰知道爲什麼和如何解決它?
謝謝!
嘗試使用ng-sanitize的正確版本,即