Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49246

I want to see an error message

$
0
0

@flycoders_sourav wrote:

When user put the work email address pattern on that time showing an error message
Like this message “please enter your valid email”

below my form HTML

<form [formGroup]="authForm" (ngSubmit)="feedbackconfirm()">
    <ion-item>
    <ion-label color="orange" floating>Full Name</ion-label>
    <ion-input type="text" [(ngModel)]="fullName" formControlName="firstname" required></ion-input>
  </ion-item>
      <ion-item>
    <ion-label color="orange" floating>Email</ion-label>
    <ion-input type="email" [(ngModel)]="email" required formControlName="email"></ion-input>
  </ion-item>
   <ion-item *ngIf="authForm.controls.email.invalid">
                <p>Please enter a valid name.</p>
    </ion-item>
   <ion-item>
    <ion-label color="orange" floating>Subject</ion-label>
    <ion-input type="text" [(ngModel)]="subject" required formControlName="subject"></ion-input>
  </ion-item>
      <ion-item>
    <ion-label color="orange" floating>Message</ion-label>
    <ion-input  type="text" [(ngModel)]="message" required spellingcheck="true" formControlName="message"></ion-input>
  </ion-item>

   <button ion-button full color="fab"  type="submit" [disabled]="!authForm.valid">Send</button>

  </form>

.ts

 this.authForm = this.fb.group({
            'firstname': ['', Validators.compose([Validators.required])],
            'email': ['', Validators.compose([Validators.required,Validators.pattern(FeedBackPage.EMAIL_REGEX)])],
            'subject': ['', Validators.compose([Validators.required])],
            'message': ['', Validators.compose([Validators.required])],
        });
  }

How can i do that?

Please tell me anyone
Thanks;

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49246

Trending Articles