How to display validation error messages in Angular 2
<p>I want to create a form where the user will enter his First_Name and Last_Name. I'd like to validate those fields in client-side. <br><br>Is there any generic forms validator in Angular 2 and also I want show the error message in client-side. How to show error messages ? <br><br>
Bellow is my code</p>

<p>html file </p>

<pre><code>&lt;form [formGroup]="myForm"  (ngSubmit)="submit()" &gt;
&lt;ion-row&gt;
  &lt;ion-item&gt;
    &lt;ion-label primary floating&gt;FIRST NAME&lt;/ion-label&gt;
    &lt;ion-input type="text" id="firstname" class="form-control" formControlName="firstname"&gt;&lt;/ion-input&gt;
  &lt;/ion-item&gt;

 &lt;ion-item&gt;
   &lt;ion-label primary floating&gt;LAST NAME&lt;/ion-label&gt;
   &lt;ion-input type="text" id="lastname"  class="form-control" formControlName="lastname" &gt;&lt;/ion-input&gt;
 &lt;/ion-item&gt;
&lt;/ion-row&gt;
&lt;/form&gt;
</code></pre>

<p>ts file:</p>

<pre><code>this.myForm = formBuilder.group({
   'firstname'  :  ['', Validators.compose([Validators.required, Validators.minLength(4), Validators.maxLength(10)])],
   'lastname'   :  ['', Validators.compose([Validators.required, Validators.minLength(1), Validators.maxLength(10)])],})
</code></pre>

<p>Backend Endpoint name and fields name:</p>

<pre><code>submit(){
    let registerNewUserObj ={
       first_name:this.myForm.value.firstname,
       last_name:this.myForm.value.lastname
</code></pre>