0
I have two pages and I want the value of an event (script below) of Page 2 to be shown in an input of Page 1.
HTML of Page 1:
<ion-list>
<ion-item text-center>
<ion-input type="text" [(ngModel)]="forca"></ion-input>
<ion-label stacked>Força</ion-label>
</ion-item>
</ion-list>
HTML of Page 2:
<ion-list>
<ion-item-sliding #item>
<ion-item (click)="showConfirm()">
<ion-avatar item-left>
<img src="assets/img/adagas.png">
</ion-avatar>
<h2>Adagas Sangrentas</h2>
<h3>Força +1, Agilidade +1</h3>
<p>Adagas preparadas para derramar sangue, feitas com lâminas forjadas em aço raro e fino.</p>
</ion-item>
<ion-item-options side="left">
<button
[style.backgroundColor]= "ativo ? 'green' : 'red'"
(click)="usar()"
>Usar</button>
</ion-item-options>
</ion-item-sliding>
</ion-list>
Script for Page 2:
usar() {
this.ativo = !this.ativo;
this.forca = 1;
console.log(this.forca);
}
In this case, by clicking "Use" the "force" input value changes to 1.