how to join two table in codeigniter easily[updated] | ci_model | ci_controller | codeigniter 3 -datainflow
In ionic use modal is very easy to show.But if you want to pass data to the modal from one controller.Then follow the below step.
First open the modal and create an object with data which you want to pass.
Step – 1
showModal() { let obj = {userId: '1', name: 'Shyam', age: 26}; let myModal = this.modalCtrl.create(MyModalPage, obj); myModal.present(); }
Now in the modal page(mymodal.ts), get that data using NavParams. First import and inject NavParams and then use the get method on NavParams to get the data you need:
Step – 2
import { Component } from '@angular/core'; import { NavParams, ViewController } from 'ionic-angular'; @Component({ selector: 'page-my-modal', templateUrl: 'mymodal.html' }) export class MyModalPage { userId: string = this.navParams.get('userId'); name: string = this.navParams.get('name'); age:number=this.navParams.get('age'); constructor(public navParams: NavParams, public viewCtrl: ViewController) {} // ... }
That’s all.
Related posts