1

Using this simple code here I keep getting a Tooltip position "undefined" is not a valid message

 <mat-form-field matTooltip="Testing tooltips" [matTooltipPosition]='right' #tooltip="matTooltip"> <input matInput [value]="Testing"/> </mat-form-field> 

My app_module.ts has

import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import {MatTooltipModule} from '@angular/material/tooltip'; 

I am using Angular 7.2. Is there something else that I need in order to get the tooltip position to work?

If I remove the matTooltipPosition then the tooltip shows fine but it's not in the place that I want it

2
  • Try adding it to input Commented Feb 7, 2020 at 5:35
  • I tried now I get "FlexibleConnectedPositionStrategy: At least one position is required." Commented Feb 7, 2020 at 5:41

2 Answers 2

4

You need to remove the [] bracket

<mat-form-field matTooltip="Testing tooltips" matTooltipPosition='right' #tooltip="matTooltip"> <input matInput [value]="Testing"/> </mat-form-field> 
Sign up to request clarification or add additional context in comments.

Comments

1
[matTooltipPosition]='right' 

This means we are doing Property Binding by which we are searching for this value('right') in the .ts file and as the value is not in the .ts file we are getting the error as invalid

By removing the square brackets [] we are giving the value 'right' directly through HTML file

<mat-form-field matTooltip="Testing tooltips" matTooltipPosition='right' #tooltip="matTooltip"> <input matInput [value]="Testing"/> </mat-form-field> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.