Skip to content

Instantly share code, notes, and snippets.

@chriskacerguis
Last active August 1, 2016 14:19
Show Gist options
  • Select an option

  • Save chriskacerguis/fcd8142392875846b13ba0a861a613ae to your computer and use it in GitHub Desktop.

Select an option

Save chriskacerguis/fcd8142392875846b13ba0a861a613ae to your computer and use it in GitHub Desktop.
quick uri segment filter
app.filter('_uriseg', function($location) {
return function(segment) {
// Get URI and remove the domain base url global var
var query = $location.absUrl().replace(BASE_URL,"");
// To obj
var data = query.split("/");
// Return segment *segments are 1,2,3 keys are 0,1,2
if(data[segment-1]) {
return data[segment-1];
}
return false;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment