26

I haven't been able to find a straightforward answer to this, which leads me to believe that it's something really really simple. Either way, here I go.

All of the calls in my $routeProvider work great, but are case sensitive. Here's a code sample:

config(function ($routeProvider) {
    $routeProvider.
        when('/', { controller: 'TmpCtrl', templateUrl: '/app/home.html' }).
        when('/foo', { controller: 'TmpCtrl', templateUrl: '/app/foo.html' }).  
        otherwise({ redirectTo: '/' });
});

What do I need to add so that '/Foo', '/fOO', '/FoO', etc, all redirect to the same path?

laser
  • 1,388
  • 13
  • 14
ThisLanham
  • 745
  • 3
  • 8
  • 20
  • Maybe this question would be helpful? http://stackoverflow.com/questions/14994324/angularjs-base-href-case-sensitive – John Sparwasser Jul 24 '13 at 03:31
  • It seems related, but I don't fully understand what I need to do to make this work from me. My assumption is that I would need to pull a specific script and include it in my project, but I'm not sure what else needs to be added. – ThisLanham Jul 24 '13 at 17:02

1 Answers1

53

There is an option you can pass to $routeProvider to toggle case sensitivity:

config(function ($routeProvider) {
    $routeProvider.
        when('/', { controller: 'TmpCtrl', templateUrl: '/app/home.html' }).
        when('/foo', { controller: 'TmpCtrl', templateUrl: '/app/foo.html', caseInsensitiveMatch: true }).  
        otherwise({ redirectTo: '/' });
});
John Sparwasser
  • 1,015
  • 13
  • 26