ellipticaldoor
ellipticaldoor

Reputation: 1272

Highlight search result with Angular filter and hide non matching text?

I found this example for highlighting a search result using Angular filter, the thing is that when you search for example 'suit' it highlight the word suit but all the non-matching text is still there.

http://demo.codeforgeek.com/highlight-angular/

How I can hide all text except the highlighted text and two or three word before and after this one?

Upvotes: 0

Views: 662

Answers (1)

Vural
Vural

Reputation: 8748

Just change the <style> part with below code:

<style>
  .highlighted { color:#000; background: yellow }
  div.container ul div { color:#fff }
</style>

this should do the trick.

Upvotes: 1

Related Questions