I\'m using a ng-repeat and filter in angularJS like the phones tutorial but I\'d like to highlight the search results in the page. With basic jQuery I would have simply pars
In did that for AngularJS v1.2+
HTML:
JS:
$scope.highlight = function(text, search) { if (!search) { return $sce.trustAsHtml(text); } return $sce.trustAsHtml(text.replace(new RegExp(search, 'gi'), '$&')); };
CSS:
.highlightedText { background: yellow; }