Dealing with form validation on model-driven forms

Open ./Client/src/app/pages/auth/register/register.component.html and replace the form tag with the following code:

 <form [formGroup]="registerForm" (ngSubmit)="onSubmit()" class="form-register" novalidate> <div class="text-center mb-4"> <h1 class="h3 mt-3 mb-3 font-weight-normal">Welcome</h1> <p>Motorcycle builders and road lovers</p> <hr> </div> <div class="form-group" [ngClass]="{ 'has-error': !registerForm.get('name').valid && (registerForm.get('name').dirty || registerForm.get('name').touched) }"> <label for="name">Name</label> <input type="name" formControlName="name" class="form-control" id="name" aria-describedby="nameHelp" placeholder="Enter your name"> <div class="form-feedback" ...

Get Hands-On Full Stack Web Development with Angular 6 and Laravel 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.