Topic: Form Error
nicolamarcopasini pro asked 6 years ago
nicolamarcopasini pro answered 6 years ago
import { Component, OnInit } from '@angular/core'; import {FormBuilder, FormGroup, Validators} from '@angular/forms'; @Component({ selector: 'app-test', templateUrl: './test.component.html', styleUrls: ['./test.component.scss'] }) export class TestComponent implements OnInit { email: string; validatingForm: FormGroup; constructor(private fb: FormBuilder) { this.validatingForm = fb.group({ 'email': [null, Validators.email], }); } ngOnInit() { } onSubmit() { console.log(this.email); } }and html:
<form (ngSubmit)="onSubmit()" [formGroup]="validatingForm"> <div class="md-form"> <i class="fa fa-envelope prefix grey-text"> </i> <input type="email" id="login-email" class="form-control" formControlName="email" [(ngModel)]="email" [ngModelOptions]="{standalone: true}" mdbInputDirective mdbActive required data-error="La mail inserita non è corretta" data-success=" "> <label for="login-email">La tua email</label> </div> <div class="text-center"> <button type="submit" [disabled]="!validatingForm.valid" class="btn peach-gradient waves-light" mdbRippleRadius style="min-width:220px">Submit</button> </div> </form>
Damian Gemza staff commented 6 years ago
Could you please try to update your project to use latest 6.1.6 version of MDB Angular and check if error still exists?nicolamarcopasini pro answered 6 years ago
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- User: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No
Damian Gemza staff commented 6 years ago
Dear nicolamarcopasini, Could you please specify in which scenario you’re getting that error? Or sample code on which I’ll be able to check it? It would help me to debug your case. Best Regards, Damian