DEV Community

Discussion on: Highlight Search Results with an Angular Pipe

Collapse
 
pranavkumar389 profile image
Pranav Kumar • Edited

I am curious about how you will handle the scenario when the innerHTML content has an HTML element.
When pet.description is <a href="#"><span>State</span></a>, and the user just enters the letter s in the search field.
The current codebase will break as the element span has also the letter 's'.

Collapse
 
juniordevforlife profile image
Jason F

Hi Pranar, thanks for taking the time to review my post. As I stated in the post, this solution met my requirements and if need be, you can tweak it. My use case did not call for having an html element within. I'd love to hear how you would approach this situation.