-
-
Save lsongdev/2a16f35df23b52e2ef25 to your computer and use it in GitHub Desktop.
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
/** | |
* Created by solomon on 15/1/14. | |
*/ | |
+function () { | |
angular.module('ui.router') | |
.provider('$otherwise', function ($urlRouterProvider) { | |
var url = ''; | |
this.path = function (url) { | |
$urlRouterProvider.otherwise(function ($injector, $location) { | |
$('body>[ui-view]').html(''); | |
var routes = $injector.get('$route').routes; | |
for(var key in routes){ | |
if(routes[key].regexp.test($location.$$url)) | |
return $location.$$url; | |
} | |
return url; | |
}); | |
}; | |
this.$get = function(){ | |
return { | |
url: url | |
} | |
}; | |
}) | |
}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment