Yes you can use them inside the AMD module but keep in mind once you add an event listener on the window object it will be called everytime there is an action:ajaxify.end. If you don't want it triggered after you leave that page you need to turn it off with $(window).off('eventName', myMethod)
Solved How to deal with placeholder in URL?
-
Hey! I set up a litte plugin.
plugin.json
"hooks": [ { "hook": "static:app.load", "method": "init" } ]
libary.js -
plugin.init()
router.get('/projects', hostMiddleware.buildHeader, controllers.getCustomParam); router.get('/projects/:tag', hostMiddleware.buildHeader, controllers.getCustomParam);
controllers.js -
Controllers.getCustomParam()
// Template which will be rendered res.render('admin/plugins/mytemplate', { title: "myTitle", sub_title: "thisIsASub" });
Everything works fine so far. But how can I deal with placeholder
/projects/:tag
e.g- /projects/diy
- /projects/mechanics
- /projects/electric
-
How can I get the value of each
:tag
and in which file do I have declare my functions? -
How can I pass data from
libary.js
into mycontrollers.js
?
I want to do some code and functions and pass this data into my template to display it to the user.
It would be nice if anyone could help me.
-
req.params.tag will give you the parameter.
-
req.params.tag will give you the parameter.