Created
October 26, 2013 19:58
-
-
Save matejkramny/7173798 to your computer and use it in GitHub Desktop.
Logout angular ui-router
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.config(function($stateProvider, $urlRouterProvider, $locationProvider) { | |
$stateProvider.state('logout', { | |
url: '/logout', | |
controller: function($scope, $route) { | |
$route.reload() | |
} | |
}) |
If you want to avoid including the angular-route
module I guess you could do:
controller: function($window) {
$window.location.reload();
}
Hey, thanks for this. It helped me alot. Here's the version I used:
// Sign IN
.state('sign-out', {
url: '/sign-out',
controller: function($state, User) {
User.signOut();
$state.go('welcome');
},
data: {
requireLogin: false,
}
})
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Same here, thank you!
Angular is telling me that I need to include
angular-route
/$routeProvider
. It would be awesome if there were a way to accomplish this without requiringangular-route
.