Open greglim81 opened 8 years ago
Of course! The only thing you have to do is to get the control correctly - this still is wrong in the code of mosh!!!
In the template you have to replace the local variable #name anf get the control via the userForm.controls Array:
<input [(ngModel)]="user.name" id="name" name="name" formControlName="name" type="text" class="form-control">
<div *ngIf="userForm.controls.name.touched && userForm.controls.name.invalid" class="alert alert-danger">
The same for the others
Hi scheilch, do you think you can share your code? I think it would just be user-form.component.ts and user-form.component.ts right?
I just Shared the snippet but Github don't Show it. Go ahead with accessing the userForm.controls.name instead of the local Variable in the html file. That should work for you.
Anyone managed to get the validators in user-form.component.html to work?