Passing id to another page Ionic 3 (RESTful API with php)

0

Good afternoon,
I'm making an ionic 3 app using the RESTful API with php for MYSQL database connection and my app lists a house with its respective consumption, it follows images of the app currently:

>

WhenIclickthisViewDetailsbuttonIwouldliketheidofthechosenroomtogototheotherpage,followthecodes:

Home.html

<ion-item-sliding*ngFor="let comodos of comodo">
  <ion-item>
    <ion-avatar item-start>
      <img src="../assets/img/ionic3-ico.png">
    </ion-avatar>
    <h2>{{(comodos.descricao)}}</h2>
  </ion-item>
  <ion-item-options side="left">
      <button ion-button color="dark">
          <ion-item class="transparente">
            <ion-icon name="flash" color="primary" item-left></ion-icon>
            <span>{{(comodos.potencia_atual)}} Wh</span>
          </ion-item>
      </button>
    </ion-item-options>
  <ion-item-options side="right">
    <button ion-button color="warning" (click)="doSearch(comodos.id)">
      <ion-icon name="home"></ion-icon>
      Ver Detalhes {{(comodos.id)}}
    </button>
  </ion-item-options>
</ion-item-sliding>

Home.ts

public doSearch(id_comodo) {
 this.nav.setRoot(TripsPage, {id: this.id});
}
    
asked by anonymous 25.07.2018 / 16:32

1 answer

0

You did almost everything, just passed the wrong id in setRoot, the right would be:

public doSearch(id_comodo) {
  this.nav.setRoot(TripsPage, {id: id_comodo});
}
    
26.07.2018 / 01:27