Highlighting a filtered result in AngularJS

前端 未结 13 2094
醉话见心
醉话见心 2020-12-01 00:12

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

13条回答
  •  温柔的废话
    2020-12-01 00:34

    Use ng-class that is applied when the search term is related to the data the element contains.

    So on your ng-repeated elements, you'd have ng-class="{ className: search_query==elementRelatedValue}"

    which would apply class "className" to elements dynamically when the condition is met.

提交回复
热议问题