I'm using ng-bind-html to render sanitized comment HTML. This is my html:
It works - the HTML is rendered and displays correctly. But I get the following error in the Javascript console:
TypeError: Object doesn't support property or method 'push'
at $$addBindingInfo (http://localhost:2239/Scripts/angular.js:6869:9)
at ngBindHtmlLink (http://localhost:2239/Scripts/angular.js:20460:9)
at invokeLinkFn (http://localhost:2239/Scripts/angular.js:8219:9)
at nodeLinkFn (http://localhost:2239/Scripts/angular.js:7729:11)
at compositeLinkFn (http://localhost:2239/Scripts/angular.js:7078:13)
at compositeLinkFn (http://localhost:2239/Scripts/angular.js:7081:13)
at publicLinkFn (http://localhost:2239/Scripts/angular.js:6957:30)
at boundTranscludeFn (http://localhost:2239/Scripts/angular.js:7096:9)
at controllersBoundTransclude (http://localhost:2239/Scripts/angular.js:7756:11)
at ngRepeatAction (http://localhost:2239/Scripts/angular.js:24553:15)
This is the code that causes the problem in angular.js:
var bindings = $element.data('$binding') || [];
if (isArray(binding)) {
bindings = bindings.concat(binding);
} else {
bindings.push(binding);
}
The bindings variable ends up being the string comment.Text, which is why it doesn't support the method push, because it's not an array.
What should I change to fix this?