deveps
January 29, 2018, 7:43am
1
i got three pages in my app…home,menu and about…in about page nothing came as output nor error,i passed the detail page value with some condition to about page …i donno what i did wrong…
about.ts
export class AboutPage {
detail = <any>[];
constructor(public navCtrl: NavController, public navParams: NavParams) {
this.detail = this.navParams.get('items')
}
}
detail.ts
export class DetailsBasic {
items = <any>[];
newsData = <any>[];
detail = <any>[];
constructor(public navCtrl: NavController, public navParams: NavParams) {
this.items = this.navParams.get('items')
this.newsData = json;
}
open(detail) {
let menuItems = this.newsData.menuItems.filter(x => x.name === detail.name);
this.navCtrl.push(AboutPage, {
items: menuItems
});
}
}
about.html
<ion-item *ngFor="let item of detail" >
{{item.title}}
{{item.body}}
Any help would be appreciated…thanks
please share your details.html code here
deveps
January 29, 2018, 10:36am
3
<ion-item *ngFor="let item of items" (click)="open(detail)">
{{item.title}}
<ion-thumbnail item-left>
<img data-src="{{item.thumb}}">
</ion-thumbnail>
<p >{{item.desc}}</p>
</ion-item>
detail.html
deveps:
(click)=“open(detail)”
You have to put item inside this open function params
like this
(click)="open(item)"
Good Luck
Thanks
deveps
January 29, 2018, 10:40am
5
i dont think thats a problem,it didnt solve issue.thanks
why ?can you explain dear @deveps ?
@deveps Try to put code to show you information about what is being passed to the navCtrl
:
open(detail) {
let menuItems = this.newsData.menuItems.filter(x => x.name === detail.name);
console.log('open', detail.name, menuItems, this.newsData);
this.navCtrl.push(AboutPage, {
items: menuItems
});
}
I think the data is not being passed properly. See the value of menuItems
in the log.
1 Like
deveps
January 29, 2018, 10:56am
8
that worked …thanks a lot