Im using this jquery plugin for searching text :”http://code.google.com/p/jquery-highlight/downloads/list “..
But im not able to wrap this code in angular js ,
I mean to say “i’m unable to write a directive to call this jquery plug in”…!!!
Updated :
Same post in Google group:
UPDATE: This is just an example. You can modify as per your needs.
You don’t need RegExp comparison for that.
Lets make simple use of javascript’s
split()function1) Define a style for highlighting.
2) Your sample HTML
3) JavaScript
Thats it….
Explanation -:
split()will break the targetString according to your searchString. This is similar to how we retrieve comma separated values. Only thing is in this case your search string acts like comma 🙂Then keep
arr[0]as it is.Highlight your search string and append it to
arr[0].Append
arr[1]to above result and so on.Simple….
Searched text as in you have to only highlight the matched part keeping rest of the text as it is?