Pass database contents from page to page

2

It seems like something simple to search, but I can not. I would like to when clicked on an item in the list, open a new page with the detailed information of that item, it will be the same information used on the homepage. But I do not know how I can do this. I created a page only, but I need to get the contents of each item clicked on it.

ImadeabuttonandwhenIclickgotothepage,Ijustneedtoreceivethedatathere.IdidnotpostthecodebecauseIdonotknowexactlywhichpartofthecodetoposthere,butifsomeonecanhelpmeandneedit,justtellme.Iwanttoreceivethesameinformationonthesecondpage,buttheselecteditem.Thanks!

htmlpage1<ion-itemno-lines*ngFor="let produto of produtos" no-padding> <h3 class="nomproduto"> {{produto.nom_produto}} </h3>

ts page 1

this.navCtrl.push(ConteudoprodutoPage, {valor: "{produto.nom_produto}"} )

ts page 2

  export class ConteudoprodutoPage {

  valor ="";


 constructor(public navCtrl: NavController, public navParams: NavParams) {
 this.valor = this.navParams.get("valor");
  }

html page 2 <ion-card-header> {{produto.nom_produto}} </ion-card-header>

    
asked by anonymous 17.08.2018 / 22:47

1 answer

3

You can pass as a parameter in the navigation between pages. This would be the code to call the next page:

this.navCtrl.push("PaginaDetalhesPage", {itemSelecionado: item});

On the page opened with details, you get the value of the navigation:

this.item = navParams.get('itemSelecionado');
    
17.08.2018 / 23:11