Search code examples
angulartooltipangular-material2

Hide Angular 2 material tooltip like ngIf


In Angular 1 Material I could use a directive, right now it is an attribute, right now it is very hard to do. How can I do it simply to only show the tooltip like when the width of page is small and hide when it is big?

I cannot find. It is not possibly to use like:

<md-tooltip ngIf="false">sometimes hidden</md-tooltip>

Solution

  • If I understand your request correctly you want to show tooltip only when a certain condition is met, try this:

    <div [matTooltip]="isWide ? 'Visible' : null"></div>