2

I have a hybrid angular application using Angular 6 and AngularJS 1.6.4. I have defined all the routes in Angular module and upgraded the AngularJS components using UpgradeComponent as stated in Upgrade Guide.

When I try to navigate from one AngularJS view to another AngularJS view using $location service, the url in browser window gets changed but the Angular Router doesn't detect the url change and same view remains loaded in UI. I tried to subscribe to router events and Location service events, none are firing.

However when I click on other link, it navigates to that link. Also after moving to new link, when I click on the back button of browser, it navigates the application to the link which didn't work earlier. Example:

  1. Current Url is http://localhost/#/App/View1
  2. Click on link to http://localhost/#/App/View2. Url is updated but View1 is still loaded in UI.
  3. Click on link to http://localhost/#/App/View3. Url is updated and View3 is loaded.
  4. Click on back button of the browser. Url is updated to View2 and View2 is loaded in UI.

If I use $window service of AngularJS instead of $location, everything works. It was working with Angular 4 before upgrading to Angular 6. Please help in making it work using $location service.

Cœur
  • 37,241
  • 25
  • 195
  • 267
dkthedon
  • 71
  • 1
  • 6

0 Answers0