用户成功login时的Angular.js路由?

我正在关注这个posthttps://medium.com/opinionated-angularjs/techniques-for-authentication-in-angularjs-applications-7bbf0346acec

我已经成功地向服务器发出了一个POST请求,并且我得到了返回的用户对象。下面的服务是什么使请求。

我不明白我在哪里可以路由到仪表板。

 /** * Authentication service via medium post Service * */ .factory('AuthService', function ($http, Session, ApiEndpoint) { var authService = {}; authService.login = function (credentials) { console.log(credentials) return $http .post('/api/login', credentials) .then(function (res) { console.log(res.data); Session.create(res.data._id, res.data.email); return res.data; }); }; authService.signup = function (credentials) { console.log(credentials.username) return $http .post('/api/signup', credentials) .then(function (res) { console.log(res.data); Session.create(res.data._id, res.data.email); return res.data; }); }; authService.isAuthenticated = function () { return !!Session.userId; }; authService.isAuthorized = function (authorizedRoles) { if (!angular.isArray(authorizedRoles)) { authorizedRoles = [authorizedRoles]; } return (authService.isAuthenticated() && authorizedRoles.indexOf(Session.userRole) !== -1); }; return authService; }) 

我已禁用查看仪表板

 .state('tab.dash', { url: '/dash', views: { 'tab-dash': { templateUrl: 'templates/tab-dash.html', controller: 'DashController' } }, resolve: { auth: function resolveAuthentication(AuthResolver) { return AuthResolver.resolve(); } } }) 

通过使用我在中等职位上find的AuthResolver服务

 /** * AuthResolver service via medium post Service * */ .factory('AuthResolver', function ($q, $rootScope, $state) { return { resolve: function () { var deferred = $q.defer(); var unwatch = $rootScope.$watch('currentUser', function (currentUser) { if (angular.isDefined(currentUser)) { if (currentUser) { deferred.resolve(currentUser); } else { deferred.reject(); $state.go('user-login'); } unwatch(); } }); return deferred.promise; } }; }) 

所以我得到它的大部分,但我不能解码到仪表板的实际路线发生?

我正在从backbone.js / marionette.js移植,并拿起angular.js昨天大声笑,所以我是新的,我build立在离子,并希望利用这个堆栈,所以我想看看我可以多快得到angular.js