Skip to Content
Java EE 8 and Angular
book

Java EE 8 and Angular

by Prashant Padmanabhan
January 2018
Intermediate to advanced
348 pages
8h 17m
English
Packt Publishing
Content preview from Java EE 8 and Angular

Validation

In our issue's reactive form template, we define two input fields for the label and description of the issue and a dropdown for selecting the user. These three inputs are marked as required, and thus we also need to display validation errors if the input has been touched and is invalid:

<form [formGroup]="issueForm" (ngSubmit)="onSave()">...    <input type="text" class="form-control" id="label"           formControlName="label">    <span *ngIf="issueForm.get('label').touched && issueForm.get('label').hasError('required')">      Label is required    </span>     <input type="text" class="form-control" id="description"           formControlName="description">    <span *ngIf="issueForm.get('description').touched && issueForm.get('description').hasError('required')"> Description ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Building Web Apps with Spring 5 and Angular

Building Web Apps with Spring 5 and Angular

Ajitesh Kumar Shukla

Publisher Resources

ISBN: 9781788291200Supplemental Content