I have function using using Angular NavigationExtras state in 2 places in my app but leading to the same urls 'activites/:name' with following state. Most of the fields are objects/array of objects.
The problem is that method works only in one page, I'm using it with the same state, can I somehow omit the cannot be cloned
error ?
goToActivity(action, data, report, preview) {
let pageUrl = action.toLowerCase();
let navigationExtras: NavigationExtras = {
state: {
date: this.reportDate,
href: this.getCurrentUrlWithoutTabs(this.router.url),
report: data,
editMode: true,
reportData: report,
previewMode: preview
}
};
this.router.navigate([`/tabs/activities/${pageUrl}`], navigationExtras);
}
It is not solution that will ALWAYS work, but if there is a need for using same routing related function, that might be good idea to separate it to the component, that can be used in many Ionic Pages. By using the component, problem is gone.