Tubiss
July 12, 2019, 7:26am
1
ı pushed the item like this.
FirstPage
openPage(item:any){
this.navCtrl.push('SecondPage', {
item: item
});
SecondPage
ı can push item
this.page1 = navParams.get('page1');
everything is okey until this.
*ngIf=“person.unit_id==item.id”
ı can pull item only which ı send. But in the html is not looking fine .
To sum up ; my problem is that ı dont want to pull all database ; ı just want to pull only ı clicked.
please help me
can’t get your problem, any sample code?
Tubiss
July 12, 2019, 8:20am
3
this my socondpage.ts
constructor(){
this.item= navParams.get(‘item’);
}
loadPeople(){
this.myProvider.load()
.then(data => {
console.log(data);
this.array= data;
//in here ı just want to make sometthing like this.
if(data.second_id==item.id){
this.array=data // but when ı made this again it display all data.ı just want to items which equal item.id
}
});
So you should remove the code “this.array= data;” after “console.log(data);”
Tubiss
July 12, 2019, 8:43am
5
now ı made its not worked, please help me
Tubiss
July 12, 2019, 8:48am
6
or can you say any other way which the solution only equal item.id
I don’t get where is your problem. Can u list out what u want to.
Tubiss
July 12, 2019, 10:07am
8
item.id is id in the first table and ı can display in the first page.
ı can send the item.id in to second page. By the way item.id is equal to in the second table as seconid
ı mean item.id=secondtable.secondid
and ı want to display item in the first page only which is equal to item.id
hope that ı was able to explain
instead of data.second_id==item.id can you check data.second_id === item.id
Tubiss
July 12, 2019, 11:00am
11
please help me how can ı pull only json data which ı send from previous page. Not all the table.
Can you add the snippet of both sending and receiving pages
Tubiss
July 12, 2019, 11:39am
13
firstpage.html
<ion-col col-6 *ngFor="let item of items" >
<div (click)="openPage(item )" >
<p>
{{item.id}}. Unite</p>
<p>
{{item.name}} </p>
</div>
</ion-col>
firstpage.ts
export class FirstPage{
openPage(item:any){
this.navCtrl.push('SecondPage', {
item: item
});
}
}
secondpage.html
<ion-col col-12 col-md-6 col-lg-4 col-xl-3 *ngFor="let itemsecond of itemsSecond" navPush="thirdPage" >
<ion-item >
<div id="democontainer">
<div id="demotext" >
<p >{{itemsecond .name}} </p>
</div>
seconPage.ts
export class secondPage{
constructor(){
this.item= navParams.get('item');
this.loaditemsSecond();
}
loaditemsSecond(){
this.myProvider.load()
.then(data => {
console.log(data);
this.itemsSecond=data; //ı want to pull only equal itemsSecond.seocon_id==item.id
});
}
}
Hi, if you only want to display all the second items that have the same id as the item passed through the params and assuming that data is an array, try:
this.itemsSecond = data.filter((itemSecond) => itemSecond.id === this.item.id);
1 Like
Tubiss
July 12, 2019, 12:09pm
15
you are great and save my day. thank yo