我想從一個express函數重定向到一個angularjs部分來加載該視圖的控制器。nodejs expressjs angularjs routing
app.js - >的NodeJS
function(req, res, next) {
console.log(req.session);
if(req.session.user/* && req.session.user.role === role*/)
next();
else
res.redirect("/#/login");
}
app.js - > angularjs
app.config(function($routeProvider){
$routeProvider
.when("/create", {
templateUrl : "https://stackoverflow.com/users/usersCreate",
controller : "users"
})
.when("/delete", {
templateUrl : "https://stackoverflow.com/users/usersDelete",
controller : "users"
})
.when("/login", {
templateUrl : "/sessions/sessionsCreate",
controller : "sessionsCtr"
})
.otherwise({ reditrectTo : "/" });
})
它不工作:(幫助