-
Notifications
You must be signed in to change notification settings - Fork 9
Route provider case sensitivity
jeme edited this page Apr 2, 2013
·
6 revisions
Some web servers will ignore caseing, so that http://dotjem.github.com/angular-routing/samples
and http://dotjem.github.com/Angular-Routing/Samples
would refer to the same thing. (e.g. IIS is known to do this by default)
Just to mirror that, the $routeProvider
can turn on a case insensitive mode using the ignoreCase
function.
angular.module('phonecat', []).
config(['$routeProvider', function($routeProvider) {
$routeProvider.
when('/phones', {templateUrl: 'partials/phone-list.html', controller: PhoneListCtrl}).
when('/phones/:phoneId', {templateUrl: 'partials/phone-detail.html', controller: PhoneDetailCtrl}).
otherwise({redirectTo: '/phones'}).
ignoreCase();
}]);
A matchCase
method also exist, this is the default state for the $routeProvider
and should not be needed, but if you wish to state explicitly that you want the routes to be case-sensitive it can be used to indicate that.
ignoreCase
and matchCase
are global and can't be turned on for some routes and not others.
- Route Provider
- Basic Configuration
- Parameters and Converters
- Decorators
- Case Sensitivity
- A Word on Trailing Slashes
- Legacy Support
- State Provider
- Basic Configuration
- Hierarchy Configuration
- Views
- Routes
- Transitions
- Resolve
- State Service
- Transition Provider
- Basic Configuration
- Stage Handlers
- Targeting Multiple States
- View Provider
- Updating Views
- Transactions
- Scroll Provider