Answers for "form submit event angular"

1

ngForm

<form #f="ngForm" (ngSubmit)="onSubmit(f)" novalidate>
  <input name="first" ngModel required #first="ngModel">
  <input name="last" ngModel>
  <button>Submit</button>
</form>

<p>First name value: {{ first.value }}</p>
<p>First name valid: {{ first.valid }}</p>
<p>Form value: {{ f.value | json }}</p>
<p>Form valid: {{ f.valid }}</p>
Posted by: Guest on September-17-2020
1

click on button submitting the form in angular

// type button required otherwise it will submit the form 
<button type="button" (click)="preview();">Preview</button>
Posted by: Guest on August-18-2020

Browse Popular Code Answers by Language