Skip to content

Commit

Permalink
fix(angular): account for replaceUrl option (#17879)
Browse files Browse the repository at this point in the history
fixes #15181
  • Loading branch information
liamdebeasi committed Mar 29, 2019
1 parent 346ecb2 commit f2c8db9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions angular/src/directives/navigation/stack-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,25 @@ export class StackController {
animation = undefined;
}
const viewsSnapshot = this.views.slice();

const currentNavigation = this.router.getCurrentNavigation();
/**
* If the navigation action
* sets `replaceUrl: true`
* then we need to make sure
* we remove the last item
* from our views stack
*/
if (
currentNavigation &&
currentNavigation.extras &&
currentNavigation.extras.replaceUrl
) {
if (this.views.length > 0) {
this.views.splice(-1, 1);
}
}

const views = this.insertView(enteringView, direction);
return this.wait(async () => {
await this.transition(enteringView, leavingView, animation, this.canGoBack(1), false);
Expand Down

0 comments on commit f2c8db9

Please sign in to comment.