I have this which works but but the regex is matching with html tags, is there any way I could get it to ignore html tags. Could anyone help me to modify the regex expression so my class is only applied to text and not matching html tags?
angular.module('my.filters')
.filter('highlight', function ($sce) {
return function (text, filterPhrase) {
if (filterPhrase) text = text.replace(new RegExp('(' + filterPhrase + ')', 'gi'), '<span class="quick-find-highlight">$1</span>');
return $sce.trustAsHtml(text);
};
});