1

FOr my angular application , I want to use $locationProvider.html5Mode(true) to remove '#' sign from URL. I also used but it is not working.

My index.html include "" in header section.

My app.js is as follows.

$routeProvider
    .when('/signIn', {
        controller: 'signInController',
        templateUrl: 'html/views/sign-in.html'

    })
    .when('/login', {
        controller: 'LoginController',
        templateUrl: 'html/views/log-in.html'
    })


    .otherwise({ redirectTo: '/login' });

     $locationProvider.html5Mode(true);

All my code (html and scripts) is under App directory. But when I am trying to run my login page is not getting loaded.

dip
  • 1,241
  • 2
  • 18
  • 32
  • do you see any errors in the console? – Rahul Garg May 30 '14 at 07:18
  • Also, is that the only code in your app.js file? Your $routeProvider... needs to go inside the config function (you will need to inject $routeProvider & $locationProvider into this function) which is available off a module declaration. Also, you'll have to include the angular-route.js since routing functionality was separated a few releases ago. – Rahul Garg May 30 '14 at 07:29
  • My $routeProvider is in config only. I added only $routeProvider code here.There is no error in console. – dip May 30 '14 at 07:36
  • Are you running this on a web server? If not, give that a try. – Rahul Garg May 30 '14 at 07:40
  • yes I did ..but same response. – dip May 30 '14 at 08:44
  • 1
    Could you please provide the relevant code for app.js and index.html so I can try it at my end here? – Rahul Garg May 30 '14 at 08:51
  • Which version of Angular are you using? You may find this useful for ng2 rc.1 http://stackoverflow.com/questions/34535163/angular-2-router-no-base-href-set – theUtherSide Jun 02 '16 at 21:52

0 Answers0