Support us .Net Basics C# SQL ASP.NET ADO.NET MVC Slides C# Programs Subscribe Buy DVD

Case sensitivity with angularjs ui-router

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.

    .state("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) {

AngularJS tutorial for beginners

No comments:

Post a Comment

If you like this website, please share with your friends on facebook and Google+ and recommend us on google using the g+1 button on the top right hand corner.