October 2018
Beginner to intermediate
478 pages
10h 8m
English
Angular provides useful validation-related techniques, one of which works by using standard HTML validation attributes.
Inspecting the REST API, we can see that the following fields' validation rules should be met:
Let's add the necessary HTML attributes to product-form.component.html to reflect these validation rules:
... <input id="title" name="title" [(ngModel)]="product.title" required minlength="3" maxlength="50" />... <select id="category" name="category" [(ngModel)]="product.category" required> <option value=''>Select category..</option> <option *ngFor="let c of categories" [value]="c.name">{{ c.name }}</option> </select> ...
Luckily, ...
Read now
Unlock full access