是否有可能以某种方式调用调用模态的控制器的方法?如何从模态调用父方法
基本上我有我在其中调用UserInfoModal的HomePage。我可以以某种方式从UserInfoModal调用HomePage.changeStatus?
家长:
@Component({
selector: 'page-home',
templateUrl: 'HomePage .html',
})
export class HomePage {
...
createModal() {
let myModal = this.modalCtrl.create(UserInfoModal, item,
this.supervisor);
myModal.present();
}
changeStatus(item) {
...
}
}
模态:
@Component({
templateUrl: 'UserInfoModal.html',
selector: 'userinfo-modal'
})
export class UserInfoModal{
...
changeParentStatus() {
// call 'changeStatus()' from parent
}
}
您可以添加代码吗? – borislemke
当你加载模态时,你可以在模态类的构造函数中做到这一点 –
也许你可以将函数传递给模态? –