Form Error

nicolamarcopasini pro asked 6 years ago

Hi, I've updated the MDB Angular library at last version. Now, when I load the forms, they give me an error: ERROR TypeError: Cannot read property 'contains' of undefined at eval (ng-uikit-pro-standard.es5.js:14889) at NodeList.forEach (<anonymous>) at eval (ng-uikit-pro-standard.es5.js:14888) at Array.forEach (<anonymous>) at MutationObserver.eval (ng-uikit-pro-standard.es5.js:14866) at ZoneDelegate.invoke (zone.js:388) at Object.onInvoke (core.js:4749) at ZoneDelegate.invoke (zone.js:387) at Zone.runGuarded (zone.js:151) at MutationObserver.eval (zone.js:129)

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

nicolamarcopasini pro answered 6 years ago

Hi Damian, this is my ts code:
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

I updated it and works fine. Thanks.
Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No