How to create a modal with parameters?


How to create a modal with parameters such as in the example ?

I copied the code from class ModalPassParams and i have met error :

EXCEPTION: No provider for NavParams! (ModalPassParams -> NavParams);

i use “ionic-framework”: “2.0.0-alpha.35”.


Hi. If you managed to do that, I need to do the same thing and I got the same error.
If someone have an answer…

EDIT : Ok, got a workaround.

In you modal, you won’t use “NavParams”, but inject “Modal” again and access to it’s “_defaults” property… Kinda weird but it works.

import {NgFor} from 'angular2/angular2';
import {
  Page, Modal
from 'ionic/ionic';
import './search.scss';

  templateUrl: 'app/search/search.html',
  directives: [NgFor]
export class SearchModal {
  constructor(modal: Modal) {
  this.modal = modal;


Thanks Thiphariel , this answer is wel , thx


Just for saying, it’s only working on 2.0.0-alpha.35, on 2.0.0-alpha.37 and newers, “navParams” works great on Modals.


in latest version… in case you end up here like I did

let newItemPage = Modal.create(NewItemModal, {"user": this.authInfo});

in constructor of the NewItemModal, the data comes through as navParams

constructor( public viewCtrl: ViewController, private _navParams: NavParams) {
    console.log("initialize NewItemModal")


Thanks, @aaronksaunders, :+1:, Exactly what I was looking for