Hello. I am working on a small application with ionic and laravel (with an API). I would like to put data in my popover and recover it.
Here is my visitorPage
`import { Storage } from ‘@ionic/storage’;
import { ApiServiceService } from ‘./…/providers/api-service.service’;
import { PoperinfoComponent } from ‘./…/poperinfo/poperinfo.component’;
import { Component, OnInit } from ‘@angular/core’;
import { ToastController, LoadingController, NavController, AlertController, ActionSheetController, ModalController } from “@ionic/angular”;
import { PopoverController } from ‘@ionic/angular’;
@Component({
selector: ‘app-visiteurs’,
templateUrl: ‘./visiteurs.page.html’,
styleUrls: [’./visiteurs.page.scss’],
})
export class VisiteursPage implements OnInit {
TOKEN_KEY = ‘api_token’;
visitors :any;
visitor = {id:’’,customer_id:’’ ,name:’’, mail:’’,phone:’’}
constructor(
public actionSheetController: ActionSheetController,
public alertCtrl: AlertController,
public modalCtrl: ModalController,
private loadCtrl: LoadingController,
private navCtrl: NavController,
private apiService: ApiServiceService,
public popoverController: PopoverController,
private storage: Storage) {}
ngOnInit() {
}
async presentPopover(ev: any) {
const popover = await this.popoverController.create({
component: PoperinfoComponent,
cssClass: ‘my-custom-class’,
event: ev,
componentProps:{key1:this.visitors },
mode:‘md’
});
return await popover.present();
}
}
//And here is my popover page
import { NavController } from ‘@ionic/angular’;
import { Storage } from ‘@ionic/storage’;
import { ApiServiceService } from ‘./…/providers/api-service.service’;
import { Component, OnInit } from ‘@angular/core’;
import { ToastController, LoadingController, AlertController, ActionSheetController, ModalController } from “@ionic/angular”;
import { NavParams } from ‘@ionic/angular’;
import { PopoverController } from ‘@ionic/angular’;
@Component({
selector: ‘app-poperinfo’,
templateUrl: ‘./poperinfo.component.html’,
styleUrls: [’./poperinfo.component.scss’],
})
export class PoperinfoComponent implements OnInit {
TOKEN_KEY = ‘api_token’;
visitors:any
visitor = {id:’’,customer_id:’’ ,name:’’, mail:’’,phone:’’}
constructor(
private navParams: NavParams,
public popoverController: PopoverController,
public navCtrl: NavController,
public actionSheetController: ActionSheetController,
public alertCtrl: AlertController,
public modalCtrl: ModalController,
private loadCtrl: LoadingController,
private apiService: ApiServiceService,
private storage: Storage) { }
ngOnInit() {
console.log(this.navParams.data);
}
}