Skip to content

Instantly share code, notes, and snippets.

@addityasingh
Last active July 16, 2018 22:10
Show Gist options
  • Save addityasingh/ccffd3ea649965c0af851ff26299cd89 to your computer and use it in GitHub Desktop.
Save addityasingh/ccffd3ea649965c0af851ff26299cd89 to your computer and use it in GitHub Desktop.
(function () {
'use strict';
angular
.module('app', [])
.config(config);
config.$inject = ['$provide'];
function config($provide) {
$provide.decorator("$route", extendRouteProvider);
extendRouteProvider.$inject = ['$delegate'];
function extendRouteProvider($delegate) {
Object.keys($delegate.routes)
.forEach(function (route) {
if ( !! $delegate.routes[route].regexp) {
var routeRegex = $delegate.routes[route].regexp.source;
// Make regex case insensitive
$delegate.routes[route].regexp = new RegExp(routeRegex, 'i');
// Add caseInsensitiveMatch property in route as true
$delegate.routes[route]['caseInsensitiveMatch'] = true;
}
});
return $delegate;
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment