0
我已經下載了yeoman angular fullstack,它帶有登錄的基本配置。登錄時檢查角色
的代碼是這樣的:
$scope.login = function(form) {
$scope.submitted = true;
if(form.$valid) {
Auth.login({
email: $scope.user.email,
password: $scope.user.password
})
.then(function() {
$scope.users = User.query();
// Logged in, redirect to home
$state.go('backend', {});
})
.catch(function(err) {
$scope.errors.other = err.message;
});
}
};
我要的是在登錄過程中檢查的作用和重定向他視它。我試着用這段代碼,但總是返回false。
if(Auth.isAdmin()){
$state.go('backend', {});
}else{
$state.go('backend', {});
}
所以,我有一個問題:
1這是什麼地方存儲在用戶對象在登錄後的客戶端?如果發生在哪裏?它具有所有的性能?
哦,非常感謝,那是我的錯誤。固定。我採取了第二種選擇,因爲我認爲這對長期來說更好。 – ssg