Case sensitivity with angularjs ui router04:33

  • 0
Published on November 7, 2017

angular ui router case insensitive

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.

If you type the following URL, then you will see a blank layout page. This is because, by default routes are case-sensitive

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);
})

Link for all dot net and sql server video tutorial playlists

Link for slides, code samples and text version of the video

Enjoyed this video?
"No Thanks. Please Close This Box!"