Hello. I need help using modules. I have attached the app.js as a module in my single page application.
There is a loadContent function in app.js. This should regenerate the content of depending on the URL parameters or the menu item clicked.
For example, if I click on the Map menu item, the map.js module is imported and the showMap function it contains is called.
However, additional links are created in the showMap function, which in turn should call the loadContent function when clicked.
However, map.js does not know this function because it is defined in app.js.
What would be best practice here? Add the event handlers after the function call showMap in the app.js? Or outsource the loadContent as module and import it everywhere? Or is my approach completely wrong?
Top comments (0)