Tuesday 30 May 2017

How to put objects dynamically in res.render

How can I get an object dynamically in res.render in express in a MEAN stack?

res.render('myTemplate', {title: 'This is my title'});

I want something like this:

res.render('myTemplate', function(){
    var myReturnObject{title: 'This is my title'};
    //do someting to generate return object;
    return myReturnObject;
});

Can anyone advise how can I generate my template variables programmatically in render function?

Thanks.



via user2854314

No comments:

Post a Comment