android - Use two controller in the same page -
i'm making first app on ionic2 , i'm little confused typescript. display popup , modal on same page: have import modalcontroller , alertcontroller 'ionic-angular'. can use alerts following code:
import { alertcontroller } 'ionic-angular'; export class mypage { constructor(public alertctrl: alertcontroller) { } }
or modal using following code:
import { modalcontroller } 'ionic-angular'; import { modalpage } './modal-page'; export class mypage { constructor(public modalctrl: modalcontroller) { } }
but when want use two, have used 2 constructors it's impossible... correct way use these 2 components?
thanks in advance!
you can inject multiple providers in constructor.. this:
constructor(public alertctrl: alertcontroller,public modalctrl: modalcontroller) {
Comments
Post a Comment