Ganny
Ganny

Reputation: 63

How to keep submit button disable until form data did not filled with reactive validation?

How can you keep a form button disabled until form data is filled in reactive form? I have created a reactive form here.

And also how can you reset reactive forms and clear the data after a submit?

Upvotes: 0

Views: 201

Answers (1)

jriver27
jriver27

Reputation: 880

You could just use the FormGroup object you created "registerForm". This object is really powerful. Check out the documentation on it.

https://angular.io/api/forms/FormGroup

I do this all the time :)

  <button [disabled]="!registerForm.valid" class="btn btn-primary">Register</button>

Upvotes: 1

Related Questions