I am trying to call the validate(ngNativeValidate) function on click of button.
My form look like:
<form #myForm="ngForm" (ngSubmit)="addEndpoint(myForm.value);" ngNativeValidate>
<section class="form-block">
<div class="form-group">
<input type="text" placeholder="name" name="name" [(ngModel)]="myData.name" [hidden]="true">
</div>
</section>
<button type="button" class="btn btn-outline" (click)="testEndpoint(myForm.value);">TEST CONNECTION</button>
<button type="submit" class="btn btn-primary" [disabled]="disableSubmit">SUBMIT</button>
</form>
Validation works as expected for SUBMIT button. I want the same behavior even for TEST CONNECTION button. but don't want to submit the form. How I can do it? I think there will be some way to just call the validator function on-click event. Any help is appreciated. Thanks! in advance.
testEndpoint is a backend call function.