Answering my own question:
I simply change to this::
$scope highlightSearch = function(text) {
text = text.replace('<', '<').replace('>', '>');
return _highlight(text, $scope.search_term, '<span
class="match">%</span>')
};
On Friday, April 4, 2014 9:55:46 AM UTC-7, Peter Bengtsson wrote:
>
> I'm trying to use ng-bind-html so that I can display some HTML in a tag.
> But the HTML I'm trying to display is really nasty and causes a badparse
> error in angular-sanitize.
>
> See http://plnkr.co/edit/FCR56Rqs6w4aoU4uGm8m
>
> The reason I use ng-bind-html is that I actually do something like this::
>
> <h5 ng-bind-html="highlightSearch(thing.title)"></h5>
>
> Which works something like this::
>
> $scope highlightSearch = function(text) {
> return _highlight(text, $scope.search_term, '<span
> class="match">%</span>')
> };
>
> This works fine as long as `thing.title` is safe plain text.
>
> So, is there a way to somehow capture the badparse error and bail on any
> fancy attempts wrapping the text in some html?
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.