Click here to Skip to main content
15,903,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,

I have a AngularJS implementation where I have mostly html and JS files and calling my WebApi from AngularControllers.

I have one implementation, where I am redirecting to index.html page.

After this code, index.html is
I stuck in a problem where I am redirecting to index.html page is getting added to my URL. This unnecessary loading index.html page every time.

When I implmented below JS code, It is working fine for Chrome and IE 10 and Above, but stopping in IE9.
PHP
app.config(function ($locationProvider) {
           $locationProvider.html5Mode(true);
       }


In IE9, it keep trying to load pages and going endlessly. (I mean it keep adding index.html and trying to redirect again and again.)

Please if someone has any idea then provide me direction.

Thanks
Rushi
Posted

1 solution

You have to Set the Route In Your Application please follow this code :-
angular.module('phonecat', []).
  config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {

    $routeProvider.
      when('/phones', {templateUrl: 'partials/phone-list.html',   controller: PhoneListCtrl}).
      when('/phones/:phoneId', {templateUrl: 'partials/phone-detail.html', controller: PhoneDetailCtrl}).
      otherwise({redirectTo: '/phones'});

    $locationProvider.html5Mode(true);

  }]);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900