How do i get html element values?

i did it like that:
first list(html):

 <ion-list class="searchbarLst" *ngIf="this.localSearch.showListAcc">
                <!--<ion-item-sliding>-->
                <ion-item class="lisItems" *ngFor="let item of this.localSearch.myListAcc" (click)="itemClicked(item, 1)">
                    <ion-icon item-left primary ios="ios-leaf" md="ios-leaf"></ion-icon>
                    <ion-label class="queryLabel"><span style="font-size: 10px;">{{"STOCKEDIT.CODE" | translate}}:{{ item.AccountsCardsID }}</span><br><span>{{ item.AccountsCardsName }}</span></ion-label>
                    <!--<div item-content detail-push>bye</div>-->
                </ion-item>
            </ion-list>

ts:

myVal;
...
itemClicked(item, num) {
this.myVal = item.name;
}

and in the second list use this myVal and you have exactly what you want with binding.

about the pages problem:
create a ts file called globalWhateve.ts (will be your service),
put it in the app providers , and import it in every page you need it and define it in the constructor.
and then use it:
this.globalVar.myVal.
if you need more help write here
try also this:


hope it helped;

1 Like