Suggested Videos
Part 43 - AngularJS ui-router configuring states
Part 44 - AngularJS ui router parameters
Part 45 - AngularJS ui router optional parameters
In this video we will discuss how to make routes that are configured using ui-router case-insensitive.
The routes that are configured using ui-router are case sensitive by default. For example, consider the state below. Notice the url (/home) is lowercase.
If we type the following URL in the browser, we will see home.html as expected.
http://localhost:51983/#/home
If you type the following URL, then you will see a blank layout page. This is because, by default routes are case-sensitive
http://localhost:51983/#/HOME
To make the routes case-insensitive inject $urlMatcherFactoryProvider service into the config() function and call caseInsensitive(true) function passing a value of true.
![AngularJS tutorial for beginners](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZqn6zmtTGarLHvPfje-F34glpNJD5qCDdkopL4zIz-_HgZcxqGgiDMCpDDCHTT9fm8G_5pCTjk3tFyD130lUgrSe_TfdFzoiBIk2kE0-YFTtSxL2kR1glEfP1JZvJCTPpPsMXCdHNd052/s1600/AngularJS+tutorial+for+beginners.png)
Part 43 - AngularJS ui-router configuring states
Part 44 - AngularJS ui router parameters
Part 45 - AngularJS ui router optional parameters
In this video we will discuss how to make routes that are configured using ui-router case-insensitive.
The routes that are configured using ui-router are case sensitive by default. For example, consider the state below. Notice the url (/home) is lowercase.
$stateProvider
.state("home",
{
url:"/home",
templateUrl: "Templates/home.html",
controller: "homeController",
controllerAs: "homeCtrl"
})
If we type the following URL in the browser, we will see home.html as expected.
http://localhost:51983/#/home
If you type the following URL, then you will see a blank layout page. This is because, by default routes are case-sensitive
http://localhost:51983/#/HOME
To make the routes case-insensitive inject $urlMatcherFactoryProvider service into the config() function and call caseInsensitive(true) function passing a value of true.
var app = angular
.module("Demo", ["ui.router"])
.config(function ($urlMatcherFactoryProvider)
{
$urlMatcherFactoryProvider.caseInsensitive(true);
})
![AngularJS tutorial for beginners](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZqn6zmtTGarLHvPfje-F34glpNJD5qCDdkopL4zIz-_HgZcxqGgiDMCpDDCHTT9fm8G_5pCTjk3tFyD130lUgrSe_TfdFzoiBIk2kE0-YFTtSxL2kR1glEfP1JZvJCTPpPsMXCdHNd052/s1600/AngularJS+tutorial+for+beginners.png)
working fine for me... Thanks
ReplyDelete