MEAN.js - 登录后重定向用户 - 在本地工作但在部署时不工作
MEAN.js - Redirect user after signin - Works locally but not when deployed
我试图在注册后重定向用户,但无论出于何种原因它在本地工作而不是在部署时工作
这是函数,$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: whatever title})
而不是在控制器中使用 $window.location.href
或尝试提供完整地址,例如 $window.location.href = "http://domain.com/settings/pictures.html"
我试图在注册后重定向用户,但无论出于何种原因它在本地工作而不是在部署时工作
这是函数,$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: whatever title})
而不是在控制器中使用 $window.location.href
或尝试提供完整地址,例如 $window.location.href = "http://domain.com/settings/pictures.html"