如何从与nodejs的angular度获得“req.something”的等价物

我正在关注如何使用nodejs和护照进行身份validation的教程。 ( http://scotch.io/tutorials/javascript/easy-node-authentication-setup-and-local )

本教程使用ejs渲染模板并传入闪存数据。

而不是这个,我想使用angularjs。 我遇到的问题是获取闪存数据。 我知道如何使用模板和发送variables,但angular度replace下面的代码中的“req.flash('signupMessage')”?

这是教程显示的代码:

app.get('/signup', function(req, res) { // render the page and pass in any flash data if it exists res.render('signup.ejs', { message: req.flash('signupMessage') }); }); 

这是我build立我的路线的代码

 // public/js/appRoutes.js angular.module('appRoutes', []).config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) { $routeProvider // show signup form .when('/signup', { templateUrl: 'views/signup.html', controller: 'SignupController' }); $locationProvider.html5Mode(true); }]); 

这里是控制器:

  // public/js/controllers/SetupCtrl.js angular.module('SignupCtrl', []).controller('SignupController', function($scope) { $scope.tagline = 'TEST'; }); 

在这里回答了类似的问题: 使用Angular&Expresslogin用户的正确方法是什么?

TLDR:发布的答案是以下链接,其中作者描述了你需要保留所有的护照在服务器端的东西,然后允许客户端(angular stuff)请求有关会话的信息。 http://vickev.com/#!/article/authentication-in-single-page-applications-node-js-passportjs-angularjs