Solution 1 :

If you must put a newline in title then replace the HTML <br> with new line n.

<div [innerHTML]="myAngularVariable" title="{{myAngularVariable.replace('<br>','n')}}"></div>

Problem :

I have an angular variable myAngularVariable=”some<br>HTML text” and a div

<div [innerHTML]="myAngularVariable" title="{{myAngularVariable}}"></div>

This way, inside the div I get the HTML of the variable interpreted, i.e. inside the div the result shown is

some
HTML text

but when i hover to show the title tooltip I get “some<br>HTML text“.

There is a way to show on hover the HTML text interpreted?

Comments

Comment posted by Andrei

it is not supported by the HTML, so no way to make it work without making a separate “title” directive which will render a popup with html supported

Comment posted by Sasha Grievus

tnx, but it is a general problem with HTML, non only with br

Comment posted by w3schools.com/css/css_tooltip.asp

Plenty of solutions if you search, e.g.

By