-
-
Save hiroshido/b8244c597267619bc819 to your computer and use it in GitHub Desktop.
AngularJSでURL末尾の"/"スラッシュを削除 ref: http://qiita.com/unamu/items/c0cba8ace1cd1cc11b94
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
$urlRouterProvider.rule(function ($injector, $location) { | |
var path = $location.url() | |
// check to see if the path has a trailing slash | |
if ('/' === path[path.length - 1]) return path.replace(/\/$/, '') | |
if (path.indexOf('/?') > 0) return path.replace('/?', '?') | |
return false; | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment