Skip to content

Instantly share code, notes, and snippets.

@luigimannoni
Last active November 12, 2015 09:35
Show Gist options
  • Save luigimannoni/2160dbac85d42f7b5231 to your computer and use it in GitHub Desktop.
Save luigimannoni/2160dbac85d42f7b5231 to your computer and use it in GitHub Desktop.
ngRoute $routeProvider exclude paths.
/**
* 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