Dear Master,
i want to passing data API from page one to page two.
let say i have data from API like this:
categories:[
{
id: 001
main_id: 001
depth: 0
name: Man
},{
id:002
main_id: 002
depth: 0
name: women
{
id: 003
main_id:001
depth: 1
name: business_man
},{
id:004
main_id: 002
depth: 1
name: business_girl
}
]
and when i serve the ionic the output of first page will printed like this:
- man 1
- women 2
HTML code of PageOne like this:
<ion-item class="tab2-selectCategory" *ngFor="let takeData of category; let i=index" >
<button (tap)=depth1()>{{i+1}} {{takeData.name}} {{takeData.id}}</button>
</ion-item>
and PageOne.ts File like this:
let filter = [];
filter.push({
field: 'depth',
operator: '=',
value: '0',
mode: 'and'
});
let param = {
api_token: '086090c7-2c12-4f00-9ac1-'',
select: 'id,depth,name',
filter: JSON.stringify(filter)
};
let apiUrl = 'http://127.0.0.1/dev_inventory_1/public/api/v1/categories';
this.httpClient.post(apiUrl, null, {params: param}).subscribe(
getData => {
this.kategori = getData['categories'];
loader.dismiss();
depth(){
this.navCtrl.push(PageTwo)
}
the question is how to send the id from page one to page two?
so, when i click 1.Man , the id (by tapped) passing to second page. in second page the sistem will print:
Business Man
and when click 2. Women (in page one) the page two will print:
Business Girl
thanks for your helping.
Regards
Andre