i have a problem when i make parsing data to another page with navparams. how can i get one id if i click one detail button and so on?
https://github.com/yandifao/app/blob/master/Untitled.png
my.ts
ionViewWillEnter(){
this.storage.get('taharrim_m').then((prof) => {
this.datauser = JSON.parse(prof);
this.offset = 0;
this.limit = 10;
this.id = this.datauser[0].id;
this.authService.getAll('transaksi',this.id,0,this.offset,this.limit).then((datatrx) => {
this.data = datatrx;
this.trxList = this.data;
//console.log(this.beritaList);
// this.berita_isi_prev = this.berita.berita_isi_prev.substr(0,200)+'...';
}).then(() => {
// console.log(this.berita_isi_prev);
});
});
}
detailTrxPpob($event, ppob){
this.navCtrl.push(TrxDetailPage, {
ppob: this.trxList });
}
my.html
<ion-refresher (ionRefresh)="doRefreshPpob($event)">
<ion-refresher-content
pullingIcon="arrow-dropdown"
pullingText="Pull to refresh"
refreshingSpinner="circles"
refreshingText="Refreshing...">
</ion-refresher-content>
</ion-refresher>
<ion-card *ngFor="let trx of trxList" >
<!-- <img src="assets/img/slide_02.png" height="60"/> -->
<ion-row>
<ion-col col-3>
<br><br>
<img src="{{ trx.trx_status == 0 ? '../../../assets/img/pending.png' : (trx.trx_status == 1 ? '../../../assets/img/pending.png':(trx.trx_status == 2 ? '../../../assets/img/proses.png':(trx.trx_status == 5 ? '../../../assets/img/sukses2.png':'../../../assets/img/gagal.png'))) }}" style="weight:10px">
</ion-col>
<ion-col col>
<ion-card-content>
<b>{{ trx.produk_id }}</b>
<p><i style="font-size:9px">{{ trx.trx_tgl }}</i></p><hr>
Harga :<b> {{ trx.trx_harga | number:0 }}</b><br>
Nomor :<b> {{ trx.trx_msisdn }} </b>
<!-- <p *ngIf="trx.trx_sn"> SN : <b>{{ trx.trx_sn }}</b></p>-->
</ion-card-content>
</ion-col>
</ion-row>
<ion-item>
<hr>
<ion-row>
<ion-col col-3>
</ion-col>
<ion-col col>
<button ion-button>SAVE</button>
</ion-col>
<ion-col col>
<button ion-button color="biru" (click)="detailTrxPpob($event, ppob)">Detail</button>
</ion-col>
</ion-row>
</ion-item>
</ion-card>
data.ts
ionViewWillEnter(){
this.ppob = this.navParams.get('ppob');
console.log(this.ppob);
this.trx_msisdn = this.ppob.trx_msisdn;
this.trx_id = this.ppob.trx_id;
this.trx_tgl = this.ppob.trx_tgl;
this.produk_id = this.ppob.produk_id;
this.trx_harga = this.ppob.trx_harga;
this.status = this.ppob.trx_status;
}
data.html
<ion-card>
<!--<img src="../../assets/img/bjork-live.jpg"/>-->
<ion-card-content class="headertrx">
<ion-card-title>
{{ trx_msisdn }}<br>
{{ trx_id }}
</ion-card-title>
{{ trx_tgl }}
</ion-card-content>
<hr>
<ion-item class="allheader">
{{ produk_id }}
<ion-badge item-end>Produk</ion-badge>
</ion-item>
<ion-item class="allheader">
{{ trx_msisdn }}
<ion-badge item-end>Nomor/IDPel</ion-badge>
</ion-item>
<ion-item class="allheader">
Rp. {{ trx_harga | number:0 }}
<ion-badge item-end>Harga</ion-badge>
</ion-item>
<ion-item class="allheader">
{{ trx_status }}
<ion-badge item-end>Status</ion-badge>
</ion-item>
<ion-item class="allheader">
{{ trx_sn }}
<ion-badge item-end>SN</ion-badge>
</ion-item>
<hr>
<ion-row>
<ion-col>
<button ion-button color="biru">CETAK</button>
</ion-col>
</ion-row>
</ion-card>