I would like to use $location.path to do a redirect in angularjs. I have the following config:
ngModule.config(['$stateProvider', '$urlRouterProvider',
function ($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/');
// Note: when adding a templateUrl, ensure that it's not a redirect but the full URL
$stateProvider
.state('logged-off', {
url: '/logged_off',
templateUrl: function () {
return '/partials/logged_off/';
}
});
}]);
Then :
$location.path('logged_off'); works fine, but I would like to refer to the state (so logged-off in this case) instead of the url. How can I do that ?