Topic: LoadingManagement esample

soiware priority asked 1 year ago

I would like to toggle a loading spinner in the page programmatically. I do not understand example in your "Loading Management" page. Here I found:

const myLoader = document.getElementById('myLoaderID');
const loader = new mdb.LoadingManagement(myLoader);

So I created a div in my page with id "myLoaderID", a button with onclick event function calling the code above. But I receive this console error:

TypeError: undefined is not a constructor (evaluating 'new mdb.LoadingManagement(myLoader)')

Am I forgetting to load some module? Please can you explain me what is "MDB UI KIT" and if I have to use:

import { Loading } from 'mdb-ui-kit';

And how have I to use this command? I tried to put this code in JS script but I get an error:

SyntaxError: Unexpected token '{'. import call expects exactly one argument.

No instructions found in you search box:

enter image description here

Thank you.

Mateusz Lazaru staff answered 1 year ago


There is an error in documentation. The proper constructor is new mdb.Loading, like in this example:

soiware priority commented 1 year ago

Thank you @mlazaru.Maybe the API section too is not updated. In your delay example I read this:

new mdb.LoadingManagement(loadingDelay, { delay: 5000, backdropID: 'delay-backdrop', }) ...loadingDelay.remove();

But in API doc the methods "remove()" doesn't exists. Can we have the complete methods list please?

Mateusz Lazaru staff commented 1 year ago

remove() from this example is not related to LoadingManagement or MDB. It's the default JS method used to remove HTML Elements from DOM.

Please insert min. 20 characters.


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



Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 6.2.0
  • Device: all
  • Browser: all
  • OS: all
  • Provided sample code: No
  • Provided link: No