如果 $rootScope.isAdmin==true,如何使 Angular.js 默认转到 /route1,但如果 isAdmin 为 false 或不存在 - 转到 /route2?
isAdmin 在登录控制器中设置:
.controller(
'LoginController',
['$scope', '$rootScope', '$http', 'authService',
($scope, $rootScope, $http, authService) ->
$scope.submit = ->
try
$http.post("/users/sign_in",
user:
email: @username
password: @password
remember_me: if @remember_me then 1 else 0
).success (response) ->
$rootScope.isAdmin = response[0].is_admin
authService.loginConfirmed()
catch ex
alert ex
])