No ouput is shown while using navparams

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

<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

You have to put item inside this open function params

like this
(click)="open(item)"
Good Luck
Thanks

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

that worked …thanks a lot