Last active
November 12, 2015 09:35
-
-
Save luigimannoni/2160dbac85d42f7b5231 to your computer and use it in GitHub Desktop.
ngRoute $routeProvider exclude paths.
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
/** | |
* Callback used on non-angular paths (the Drupal paths for example) This triggers simply triggers a refresh of the browser. | |
* | |
* @function redirect | |
* @param {string} skip Argument passed from ngRoute, not used | |
* @param {string} url Argument with the link | |
*/ | |
var redirect = function(skip, url) { | |
window.location.href = url; | |
} | |
/** | |
* Example application on $routeProvider. | |
*/ | |
angularApp.config(function($routeProvider) { | |
$routeProvider | |
.when('/user', { redirectTo: redirect }) // User paths | |
.when('/user/:query', { redirectTo: redirect }) | |
.when('/user/:query/:rest*', { redirectTo: redirect }) | |
.when('/admin', { redirectTo: redirect }) // Admin paths | |
.when('/admin/:query', { redirectTo: redirect }) | |
.when('/admin/:query/:rest*', { redirectTo: redirect }); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment