0

Scenario : I have update my current angularjs version from AngularJS v1.5.5 to AngularJS v1.5.7. Application is working fine but there is issue with URL routing it is behaving different. Let's see acceptance criteria below.

Try 1

Original URL as below and this is the expected result also.

https://u-unalytix.milestoneinternet.com/Unalytix.Web.UAT/dashboard/marketing-channels

Just after update version I was getting error with commented lines which below.

$locationProvider.html5Mode(true);  
// $urlrouterprovider.rule(function ($injector, $location) {
       // var path = $location.path();
       // if (path != '/' && path.slice(-1) === '/') {
          // $location.replace().path(path.slice(0, -1));
       // }
// });

Result :

https://u-unalytix.milestoneinternet.com/U/dashboard/marketing-channels

You can see here due to some reason we are not getting the expected result.Then I try with another code of piece in module.config. After googling I got some answer to resolve this issue and I tried as follow but still could not got expected result.

Try 2

I tried with this piece of code still could not got expected result.

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

Result :

This time getting /# in URL.

https://u-unalytix.milestoneinternet.com/Unalytix.Web.UAT/#/dashboard/marketing-channels

Don't know the issue. If anyone have idea about this issue then please share with me.

1 Answer 1

0

To achieve this you need to make two changes.

  1. Add this inside your config.
$locationProvider.html5Mode(true);
$locationProvider.hashPrefix('');
  1. Add base of your application in your index.html head tag
<head>
...

  <base href='/' />

...
</head>
Sign up to request clarification or add additional context in comments.

1 Comment

Looking at your urls, it seems base url is Unalytix.Web.UAT. If above solution doesn't work, change to <base href="/Unalytix.Web.UAT" />

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.