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 parsed the page on key up on the input, but I'm trying to do it the angular way. Any ideas ?
My code :
<input id="search" type="text" placeholder="Recherche DCI" ng-model="search_query" autofocus>
<tr ng-repeat="dci in dcis | filter:search_query">
<td class='marque'>{{dci.marque}} ®</td>
<td class="dci">{{dci.dci}}</td>
</tr>
In did that for AngularJS v1.2+
HTML:
JS:
CSS:
angular ui-utils supports only one term. I'm using the following filter rather than a scope function:
And the HTML:
Another proposition:
I'm open to criticism ! ;-)
I hope my light example will make it easy to understand:
index.html
app.js
Reference : http://codeforgeek.com/2014/12/highlight-search-result-angular-filter/ demo : http://demo.codeforgeek.com/highlight-angular/
Try Angular UI
Filters -> Highlite (filter). There is also Keypress directive.