0

When I directly refresh the browser using F5 or directly hitting the url, page not load but when I click on the button then the page gets load

I am using like this

Enable HTML5Mode using $locationProvider

var routerApp = angular.module('myApp', ['ui.router','ngCookies']);
routerApp.config(function($locationProvider){
    $locationProvider.html5Mode({
          enabled: true
    })
});

I Added the following code to the of your HTML file:

<base href="/">

or Simply using Syntax like that

$locationProvider.html5Mode({
          enabled: true,
          requireBase: false
    })

I find that this is already issue on https://github.com/angular-ui/ui-router/issues/105

Can someone knows how to solve this ? When I am not using $locationProvider for omitting '#' then it is working fine with refreshing too

2
  • Is there any reason why you need to omit #? Why not just keep the prefix? Commented Mar 29, 2017 at 13:01
  • as per the requirement, need to omit # from the url Commented Mar 30, 2017 at 5:47

2 Answers 2

1

Attempt this

$locationProvider.html5Mode({
    enabled: true,
    requireBase: false
})
Sign up to request clarification or add additional context in comments.

1 Comment

Also tried that too but it didn't work and now I write in question too
0

Try

$locationProvider.html5Mode({
    enabled: true,
    requireBase: false
})

1 Comment

Also tried that too but it didn't work and now I write in question too

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.