Reputation: 4814
<input type ="text" name="something" id="something"required (click)="saveData()>
I have input field like this if the required error is not there then only click mouse event should work(call).!
how can I do that.? i am new to angular
I want something like this:
<input type ="text" name="something" id="something"required *ngIf="something.errors == null (click)="saveData() " >
Upvotes: 0
Views: 488
Reputation: 58543
You can do this like :
(click)="something.errors == null ? saveData() : false"
OR as @PankajParkar's comment
(click)="something.errors?.length && saveData()"
Upvotes: 1