Hi everyone, I have a problem with passing data from one page to another. The page that displays the data is called contents.page.html
<ion-header>
<ion-toolbar>
<ion-title>APPapagna 2.0</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-item *ngFor="let item of items">
<ion-row>
<ion-col col-3>
{{item.Titolo}}
</ion-col>
<ion-col col-3>
{{item.Nome_Punto}}
</ion-col>
<ion-col col-3>
<button
ion-button
color="primary"
item-right
(click)="viewEntry(item)">view</button>
</ion-col>
</ion-row>
</ion-item>
</ion-content>
this is the file code instead contenuti.page.ts
import { Component } from '@angular/core';
import { NavController, NavParams } from '@ionic/angular';
import { HttpClient } from '@angular/common/http';
import { Router } from '@angular/router';
@Component({
selector: 'app-contenuti',
templateUrl: './contenuti.page.html',
styleUrls: ['./contenuti.page.scss'],
})
export class ContenutiPage {
public items : Array<any> = [];
constructor(
public navCtrl: NavController,
public http : HttpClient,
public passa_var : Router
)
{ }
ionViewWillEnter() : void {
this.load();
}
load() : void {
this.http
.get('http://www.my-dominio.com/retrieve-data.php')
.subscribe((data : any) =>
{
console.dir(data);
this.items = data;
},
(error : any) =>
{
console.dir(error);
});
}
viewEntry(item) : void {
??????
}
}
clicking on “view” I have to go to the detail page.
I can’t understand how to pass data to the detail page to view the data of the single record. Can anyone give me directions on how to pass data?