Suppose I have a variable called data
in the app.component.ts
file of type :string
.
In the app.component.html
file, I am displaying the value of data
on the UI using string interpolation like {{data}}
.
My question is, how can I apply some css to specific letters within the data
variable while displaying it in the UI?
For example:
app.component.ts
data: string = "stack overflow"
app.component.html
<p>{{data}}</p>
How can I highlight the background color of the word 'overflow' using css? I know that Pipes are used to modify values, but in this case, I need to apply css.
Additionally, another requirement is that initially, the value will be displayed on the browser, and the word to be highlighted will come from an input
box.