Topic: LoadingManagement esample
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);
loader.toggle();
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:
Thank you.
mlazaru staff answered 2 years ago
Hi,
There is an error in documentation. The proper constructor is new mdb.Loading
, like in this example:
https://mdbootstrap.com/docs/standard/methods/loading-management/#section-js-init
soiware pro premium priority commented 2 years 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?
mlazaru staff commented 2 years 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.
https://developer.mozilla.org/en-US/docs/Web/API/Element/remove
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Open
- User: Pro
- 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