Expressjs res.render 不渲染 angularjs 部分中的值 [英] Expressjs res.render not rendering values in angularjs partials

查看:24
本文介绍了Expressjs res.render 不渲染 angularjs 部分中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在登录后在 expressjs 上登录后重定向到下一页,我有一些部分要从 angularjs 路由器加载,这一切正常且工作正常.在 res.render 中,我有一些这样的数据集.

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});

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

在 Angularjs 上,我有一个 jade 模板,它可以正常加载,我正在尝试打印日期时间和时间表,这是代码

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

****在 #{DateTime} 和 #{timesheet}

****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 **

推荐答案

我的 jade 模板中有这样的东西(我正在发送一个 api 对象和一个令牌)

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}';

我将两者都声明为在 AngularJS 中重复使用的全局变量.希望这会有所帮助.

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

这篇关于Expressjs res.render 不渲染 angularjs 部分中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆