Case Insensitive Routing in angularjs


Route configured using config function on the module is by default case sensitive. Its a good idea to make our routes case insensitive for various reasons. Its very simple to make routes case insensitive by setting one property on $routeProvider serivce.












app.config(function($routeProvider){

$routeProvider.caseInsensitiveMatch=true;

  $routeProvider.
          when('/',{
            templateUrl:'home.html'
          })
          .when('/page1',{
            templateUrl:'page1.html'
          })
          .when('/page2',{
            templateUrl:'page2.html'
          })
          .otherwise('/');
          
});
 


Comments

  1. Awesome Blog, I Loved it, Me first time here in the Blog. Totally Impressed.
    AngularJS Training in Chennai | AngularJS Training Institute in Chennai

    ReplyDelete
  2. I like your post very much. It is very much useful for my research. I hope you to share more info about this. Keep postingangular course

    ReplyDelete
  3. Tioga Gold: a gemstone of the world of titanium price
    The titanium-aged copper-plated pieces titanium bike frame of titanium rocket league titanium white are inscribed in the walls of the micro touch hair trimmer main tower and feature a tube supplier gold-tipped stainless steel frame titanium exhaust wrap

    ReplyDelete

Post a Comment

Popular Posts