How do you popToRoot
with a parameter?
This says the following is possible:
this.nav.popToRoot({
employeeModel: this.employeeModel
});
However, when I try it, I get:
[ts]
Argument of type '{ employeeModel: EmployeeModel; }' is not assignable to parameter of type 'NavOptions'.
Object literal may only specify known properties, and 'employeeModel' does not exist in type 'NavOptions'.
(property) employeeModel: EmployeeModel
Any ideas please?
This indicates that popToRoot
takes a paremeter of options
.
popToRoot(opts)
How do you popToRoot
forcing the root page to reload with the passed parameters?
I think you should use onPageWillEnter instead of the constructor on the root page, to check the navParams?
Then you need not to reload the whole view, if you update the data that is bound to it
Thanks twicejr,
I try that, but unfortunately it does not work.
let options = {
employeeModel: this.employeeModel
};
this.nav.popToRoot(options);
root
onPageWillEnter() {
this.employeeModel = this.navParams.get('employeeModel');
console.log('onPageWillEnter : '+this.employeeModel);
this.zone.run(() => {
this.getPosition();
});
}
the root does not reload.
Maybe like this:
onPageWillEnter() {
this.zone.run(() => {
console.log('onPageWillEnter : '+this.employeeModel);
this.employeeModel = this.navParams.get(‘employeeModel’);
this.getPosition();
});
}
How does your view look for the variable part?
Nothing.
It does not even do the console.log
with
let options = {
employeeModel: this.employeeModel
};
this.nav.popToRoot(options);
However,
if (this.fromSearch === true) {
this.nav.insert(0, SearchPage, {
employeeModel: this.employeeModel
});
works, but the menu toggle button does not work
More