我尝试在注册后重定向用户,但无论出于何种原因它在本地运行而不是在部署时运行
这是该函数,$window.location.href = '/settings/picture';
在部署时无效
$scope.signup = function (isValid) {
$scope.error = null;
if (!isValid) {
$scope.$broadcast('show-errors-check-validity', 'userForm');
return false;
}
$http.post('/api/auth/signup', $scope.credentials).success(function (response) {
// If successful we assign the response to the global user model
$scope.authentication.user = response;
// And redirect to avatar selection screen
$window.location.href = '/settings/picture';
}).error(function (response) {
$scope.error = response.message;
});
};
最佳答案
您可以尝试在 post('/api/auth/signup') 路由中使用 res.render('/settings/picture', {title: another title})
而不是使用 $ Controller 中的 window.location.href
或者尝试提供完整的地址,例如 $window.location.href = "http://domain.com/settings/pictures.html "
关于javascript - MEAN.js - 登录后重定向用户 - 在本地工作,但在部署时不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36903147/