'<router-outlet> persists when in AngularJS state (Hybrid application)

Using a hybrid application (AngularJS and Angular 8) with hybrid routing.

Here is the app.component template, which is an Angular 8 component -
<main ui-view></main>
<router-outlet></router-outlet>

Both routes display simultaneously. This is only triggered when using the browser back function.

Example - Navigate from Angular 8 route to AngularJS route via $state.go(). Use browser back button to nav back to Angular 8 route. Navigate to JS route again via $state.go(). The Angular8 remains on the page along with the <main-ui-view>.

When navigating to an Angular 8 route, $state.go() is used to go to an empty state, clearing the ui-view.

Let me know what other information I should provide.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source