I'd like to get the text of an HTML string using AngularJS filters but it seems not working with my code.
My code :
app.filter('unsafe', function($sce) {
return $sce.trustAsHtml;
});
app.filter('short', function() {
return function(short, length) {
return short.substr(0, length || 20)+'...';
}
});
My template :
<p ng-bind-html="event.description | unsafe | short"></p>
Edit #1 :
Error: [$injector:unpr] Unknown provider: unsafeFilterProvider <- unsafeFilter