Topic: MDB V5 Angular Form Borders - Cannot read property 'style' of null

zkmark pro asked 1 year ago


Expected behavior

The borders of the form input should turn blue when you click

Actual behavior

I get the following error in angular 11

zone-evergreen.js:171 Uncaught TypeError: Cannot read property 'style' of null

at o.value (mdb.min.js:19)
at o.value (mdb.min.js:19)
at o.value (mdb.min.js:19)
at HTMLInputElement.<anonymous> (mdb.min.js:19)
at HTMLDocument.t (mdb.min.js:19)
at ZoneDelegate.invokeTask (zone-evergreen.js:399)
at Zone.runTask (zone-evergreen.js:167)
at ZoneTask.invokeTask [as invoke] (zone-evergreen.js:480)
at invokeTask (zone-evergreen.js:1621)
at HTMLDocument.globalZoneAwareCaptureCallback (zone-evergreen.js:1690)

Note: I load all the mdb.min.js in angular.json

Solution

I solved it using the code from here https://es.stackoverflow.com/questions/262061/uncaught-typeerror-cannot-read-property-style-of-null-que-no-puedo-solucionar

Modify the mdb.min.js file and wrap it in the following code

document.addEventListener("DOMContentLoaded", function () {
//here all mdb.min.js

});


Risal Fajar free answered 1 year ago


I'm experiencing the same issue using Svelte. Above solution does not work.

mdb.min.js:23 Uncaught TypeError: Cannot read properties of null (reading 'style')
at r.value (mdb.min.js:23)
at r.value (mdb.min.js:23)
at eval (mdb.min.js:23)
at o (mdb.min.js:23)
at r.value (mdb.min.js:23)
at HTMLInputElement.eval (mdb.min.js:23)
at HTMLDocument.t (mdb.min.js:23)

Grzegorz Bujański staff commented 1 year ago

Unfortunately, we do not support MDB Standard integration with Svelte. Such integration should be done on your own. It's hard to say what could be causing this error and why the integration failed.



Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Answered

Specification of the issue

  • User: Pro
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: 3.0.0
  • Device: Pc
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: Yes