Issue
I am trying to make a mat-label clickable using (click)="doSomething()"
I have googled this issue and cant find any solution
this is an example of the html code I wish to make clickable
<mat-form-field class="col-md-2">
<mat-label (click)="doSomething()"></mat-label>
</mat-form-field>
what I wish to accomplish is to keep the mat-label styling and when clicked make another mat-form-field display
Solution
If you want to write <mat-label>
inside of <mat-form-field>
then you must define at least one MatFormFieldControl like matInput, mat-select, etc
under <mat-form-field>
. It will not work with just <mat-label>
.
<mat-form-field>
<mat-label>Both a label and a placeholder</mat-label>
<input matInput placeholder="Simple placeholder">
</mat-form-field>
But If you want to just use <mat-label>
then don't write it under <mat-form-field>
Here is the demo for your desired output
Click here!!
Answered By - Codeptive Solutions
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.