-
Notifications
You must be signed in to change notification settings - Fork 9
Route provider case sensitivity
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', ['dotjem.routing']).
config(['$routeProvider', function($routeProvider) {
$routeProvider
.ignoreCase()
.when('/phones', {
templateUrl: 'partials/phone-list.html',
controller: PhoneListCtrl})
.when('/phones/:phoneId', {
templateUrl: 'partials/phone-detail.html',
controller: PhoneDetailCtrl})
.otherwise({redirectTo: '/phones'});
}]);
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.
It's unnecessary to turn on even for web-servers that ignore case, but if your really use to them you might write links around your application with random casing like: /Articles
vs. /articles
... and this idiot profs that somewhat.
- 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