This is my filter in Angular, I've only shown the snippet of it the application. This works in one controller but when I try to use it in another one it doesn't.
What I mean by is doesn't work - it doesnt render inside the DOM. It renders inside the tags though.
AngularJS:
<h2 ng-bind-html="'{{ answer.title }}' | to_trusted"></h2>
Example Rendered
<h2 ng-bind-html="'0-60 minutes per week' | to_trusted" class="ng-binding"></h2>
AngularJS Filter
.filter('to_trusted', ['$sce', function($sce){
return function(text) {
return $sce.trustAsHtml(text);
};
}])
Have I missed something out by accident here?
''to wrap the{{}}?Error: [$parse:syntax] http://errors.angularjs.org/1.2.18/$parse/syntax?p0=to_trusted&p1=is%20an%20unexpected%20token&p2=4&p3=%20%7C%20to_trusted&p4=to_trusted at Error (native)Error message