Expressjs res.render not rendering values in angularjs partials

那年仲夏 提交于 2019-12-13 04:36:37

问题


I am redirecting to next page after login on expressjs after login, I have some partials to be loaded from angularjs routers which is all fine and working. In res.render I have some data set like this.

res.render('employelogin/employlogin', { title: 'Sheet | Employee',userName: req.session.nameName,DateTime:resultDate,timesheet:timeSheet});

On the Angularjs, I have a jade template which loads fine as told, there I am trying to get the DateTime and Timesheet being printed this is the code

****was at #{DateTime} and was #{timesheet}

I am not getting the datetime and timesheet text being printed here.

** The data for the fileds are coming. I have seen it coming on console **


回答1:


I have something like this in my jade template (I'm sending an api object and a token)

    script(type="text/javascript").
        var api = !{JSON.stringify(api)} , token= '!{token}';

I declare both as global variables that I re-use in AngularJS. Hope this helps.



来源:https://stackoverflow.com/questions/22201441/expressjs-res-render-not-rendering-values-in-angularjs-partials

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!