Passing data to a modal

0

I'm trying to pass data to a modal. I think I got the first part, because in the chrome console I see that I received this data, but I do not know what is wrong, that I can not see them on the screen.

Home Html

 <button ion-button small class="button-select" (click)="openFiltrosModal()">Filtros</button>

Home TS

export class HomePage implements OnInit {
regioes: Regiao[];

constructor(public modalCtrl: ModalController, private nav: NavController, 
private videoPlayer: VideoPlayer, private payPal: PayPal, public viewCtrl: 
ViewController,public navCtrl: NavController, public navParams: NavParams, 
public db: DatabaseProvider, private toastCtrl: ToastController)

 openFiltrosModal() {
this.openModal('FiltrosModalPage');
}
openModal(pageName) {

this.modalCtrl.create(pageName, {'val': this.regioes}, { cssClass: 'inset- 
modal' })
              .present();
}

MODAL TS

import { Component } from '@angular/core';
import { NavParams, NavController, ViewController, IonicPage } from 'ionic- 
angular';
import { Regiao } from '../../models/regiao';

@IonicPage()
@Component({
selector: 'page-filtros-modal',
templateUrl: 'filtros-modal.html'
})
export class FiltrosModalPage {
regioes: Regiao;
myParam: string;

constructor(public navParams: NavParams, public viewCtrl: ViewController) {
console.log(navParams.get('val'));
this.myParam = navParams.get('myParam');
}

dismiss() {
this.viewCtrl.dismiss();
}

}

MODAL HTML

  <ion-select interface="popover" (ionChange)="selecionaregiao($event)" 
  [(ngModel)]="regiao">
  <ion-option *ngFor="let regiao of regioes" [value]="regiao.id"> 
  {{regiao.nom_regiao}}</ion-option>
  </ion-select>

Can anyone help me with this? I do not know if I'm doing it wrong or forgetting something

    
asked by anonymous 28.09.2018 / 16:31

1 answer

1

HTML is looking for variable regioes and not myParams . In the constructor, change this.myParam = navParams.get('myParam'); to this.regioes = navParams.get('myParam'); .

    
28.09.2018 / 16:39