P
P
Pogran2016-12-08 10:51:25
Angular
Pogran, 2016-12-08 10:51:25

Is it possible to display automatic error messages in a form?

When building a form, I use FormBuilder and Validators . If an error occurs, then you have to output a message like this

<div class="alert alert-danger" *ngIf="userForm.controls['email'].hasError('required') && userForm.controls['email'].touched">Not valid.</div>

Maybe there is some other way to display messages, and not manually writing Not valid. how am i now

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ruslan Lopatin, 2016-12-08
@Pogran

You can always write a directive.
I wrote this for myself

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question