As mentioned by @Pace, you can refer to the Ionic2 documentation for guidance on how to generate a Modal
.
There is no need to include it in the providers
array or in your constructor
as you are currently doing. Instead, utilize the Modal.create(...)
method as demonstrated below:
import { Modal, NavController, NavParams } from 'ionic-angular';
@Component(...)
class HomePage {
constructor(/* ..., */ private nav: NavController) {
// Your code...
}
presentProfileModal() {
// Create the modal using the layout from the Profile Component
let profileModal = Modal.create(Profile, { paramId: 12345 });
// Show the modal
this.nav.present(profileModal);
}
}
@Component(...)
class Profile {
constructor(/* ..., */ private params: NavParams) {
// Retrieve the parameter using NavParams
console.log('paramId', params.get('paramId'));
}
}