Issue
In my Ionic app, I am opening a Model after clicking a button. I need to pass data to modal and catch it in modal. How can I do this.
this is my code.
home.html
<button ion-button (click)="openDialog()">open</button>
home.ts
openDialog() {
let dialog = this.modal.create(MyPage);
dialog.present();
}
Solution
You can pass data to modal
as the second argument of create
method.
let dialog = this.modal.create(MyPage, { title: 'This is MyPage Page'});
You can get data in modal
using NavParams
.
constructor(public navParam: NavParams) {
this.title = this.navParam.get('title');
}
Answered By - Sudarshana Dayananda
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.