I’d like to use angular2 input and output bindings for pages and modals in Ionic 2. My home page contains many different pieces of information including info for many parties displayed using a loop.
I would like to open another page, or better a modal, passing the info of one of the parties using [party] = 'selectedParty'
. Changing it in the modal/page should automatically change it in the homepage hosting the input. If this is not the way to do it with Ionic 2, please guide me to the right direction.
Using NavParams maybe is good for passing a piece of info to another page, but passing it back with this doesn’t seem to make sense.
Using this in the home page this.party = _navParams.get("party")
will not tell me which party is coming back, as well I will have to do this for every piece of info I want to have the modal for.
<ion-item *ngFor='let party of calculation?.parties'>
<ion-label>{{party.name}}</ion-label>
<ion-label (click)='selectedParty=party'>
<div class='float-right italic xs'>
<span class='party-gender' *ngIf='party.gender === "M"'>Male,</span>
<span *ngIf='party.gender === "F"'>Female,</span>
<span>{{party.age || 0}}, </span>
<span>Resident of {{party.provinceId}}</span>
</div>
</ion-label>
</ion-item>
</ion-list>
<page-edit-party-info
*ngIf='selectedParty'
[party]='selectedParty'
>
</page-edit-party-info>