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)
Script to display all posts by _id
-
I have a custom route with custom template. I have a list of post _id's that I need to be displayed on this custom template. Pretty much like how it looks when you filter by tag.
Very new to nodebb, please point me to the right direction how I can query posts by _id and pass it to be displayed on template.
-
-
@pitaj excuse my ignorance, But how would I use this?
I've tried
function testrender(req, res, next) { const Posts = require('../../src/posts/data.js'); var postid = '60617ae45d48fbb848f496aa'; res.render('test321', { uid: Posts.Posts.getPostData(postid) }); };
But I get error "Cannot read property 'getPostData' of undefined" ?
-
@ape the standard way to get nodebb modules is
require.main.require
const Posts = require.main.require('./src/posts'); Posts.getPostData(pid, callback)