Created
March 11, 2016 14:19
-
-
Save mrded/44b55b1f3fbf7121d6b4 to your computer and use it in GitHub Desktop.
AngularJS 1.x & ui.router: How to show 404 stage by staying on the same URL.
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
angular.config(function($urlRouterProvider, $stateProvider) { | |
$stateProvider.state('404Page', { template: '404' }); | |
$urlRouterProvider.otherwise(function($injector, $location) { | |
$injector.get('$state').go('404Page', {}, { location: false }); | |
return $location.path(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment