1

I'm writing code to add angular material tooltip with ts code to angular 7.

In template its added. But tooltip don't work.

let outerRect = $('<div  matTooltip="Hello" matTooltipPosition="right"></div>');

In template shown:

<div mattooltip="Hello" mattooltipposition="right">

But don't work when hover to element.

qwerty
  • 679
  • 5
  • 12
  • you can't use directive using innerHTML. for more read: https://stackoverflow.com/questions/46217049/angular-2-how-can-i-apply-directives-to-sanitized-html-innerhtml – MullisS Jan 21 '19 at 08:15
  • Adding to @MullisS's comment, why exactly are you adding it in the TS Class anyway? Any specific reason? What's that you're trying to achieve here? – SiddAjmera Jan 21 '19 at 08:19
  • I'm also facing the same issue.Any solution? – Pyntamil Selvi Jul 31 '20 at 03:14
  • facing same issue, mattooltip not workinh with innerHtml property binding. Any suggestions – SSS Aug 05 '21 at 04:26
  • @SiddAjmera my case, im modifying the mat-calendar and i want to add details in the day cell so i used innerHTML to add htm elements to it including a mat-icon. Sadly, the tooltip directive doesnt work. – chitgoks Aug 02 '23 at 08:53

0 Answers0