Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: MdbInputDirective ngOnInit ERROR

nextage pro asked 6 years ago


Error after upgrading to version 6.1.5 Please solve it immediatly and try to write better code. ERROR TypeError: Cannot read property 'childNodes' of null
MdbInputDirective.prototype.ngOnInit = function () {
...
if ((mutation.target['classList'].contains('ng-pristine')) && /** @type {?} */ (mutation.target['classList'].contains('ng-invalid'))) {
mutation.target.offsetParent.childNodes.forEach(function (element) {
  if (element.classList.contains('text-danger') || element.classList.contains('text-success')) {
    _this._renderer.setStyle(element, 'visibility', 'hidden');
  }
});


                
                  

Damian Gemza staff commented 6 years ago

Dear nextage, 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

nextage pro answered 6 years ago


Problem fixed. Thanks for your support. Best Regards.

nextage pro answered 6 years ago


Property "offsetParent" became equal to "null" when the target, or the context in which the target is nested, is not displayed (display: none). - eg. in a modal - So you have to check if "offsetParent" exists, at least. Thank you Damian.    

Damian Gemza staff commented 6 years ago

Dear nextage, Could you please do npm install one more time? I have fixed this problem, so it should work fine now. Best Regards, Damian


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

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: Yes
  • Provided link: No
Tags