Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions 14 angular/src/directives/navigation/ion-router-outlet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,20 @@ export class IonRouterOutlet implements OnDestroy, OnInit {
if (this.activated) {
if (this.activatedView) {
this.activatedView.savedData = new Map(this.getContext()!.children['contexts']);

/**
* Ensure we are saving the NavigationExtras
* data otherwise it will be lost
*/
this.activatedView.savedExtras = {};
const context = this.getContext()!;

if (context.route) {
const contextSnapshot = context.route.snapshot;

this.activatedView.savedExtras.queryParams = contextSnapshot.queryParams;
this.activatedView.savedExtras.fragment = contextSnapshot.fragment;
}
}
const c = this.component;
this.activatedView = null;
Expand Down
2 changes: 1 addition & 1 deletion 2 angular/src/directives/navigation/stack-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export class StackController {
}
}

return this.navCtrl.navigateBack(url).then(() => true);
return this.navCtrl.navigateBack(url, view.savedExtras).then(() => true);
});
}

Expand Down
3 changes: 2 additions & 1 deletion 3 angular/src/directives/navigation/stack-utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ComponentRef } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { ActivatedRoute, NavigationExtras, Router } from '@angular/router';
import { NavDirection, RouterDirection } from '@ionic/core';

export function insertView(views: RouteView[], view: RouteView, direction: RouterDirection) {
Expand Down Expand Up @@ -94,5 +94,6 @@ export interface RouteView {
element: HTMLElement;
ref: ComponentRef<any>;
savedData?: any;
savedExtras?: NavigationExtras;
unlistenEvents: () => void;
}
11 changes: 10 additions & 1 deletion 11 angular/src/providers/nav-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,16 @@ export class NavController {
if (Array.isArray(url)) {
return this.router!.navigate(url, options);
} else {
return this.router!.navigateByUrl(url, options);

/**
* navigateByUrl ignores any properties that
* would change the url, so things like queryParams
* would be ignored unless we create a url tree
* More Info: https://github.com/angular/angular/issues/18798
*/
return this.router!.navigateByUrl(
this.router!.createUrlTree([url], options)
);
}
}
}
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.