Last active
August 1, 2016 14:19
-
-
Save chriskacerguis/fcd8142392875846b13ba0a861a613ae to your computer and use it in GitHub Desktop.
quick uri segment filter
This file contains hidden or 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
| 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