I have an ion-select which has loaded data from a rxjs observable. Every time there is a change in my observable the ion-select is updated which is correct behaviour. However, my whole form is cleared too. Is there a way to disable this?
<form *ngIf="sendForm" [formGroup]="sendForm" id="sendForm">
<ion-list class="ion-no-padding">
<ion-item class="no-hover no-ripple ion-no-padding" lines="none">
<ion-label position="stacked">Token</ion-label>
<ion-select
interface="action-sheet"
formControlName="tokenid"
[(ngModel)]='itemSelected'
(ionChange)="onItemSelection($event)"
class="no-hover no-ripple input"
[placeholder]="myTokens.length > 0 ? 'Select A Token' : 'No sendable tokens available.'"
>
<ion-select-option *ngFor="let token of myTokens" [value]="token.tokenid" class="token-option">
<span *ngIf="token.tokenid !== '0x00'">
{{ token.token + " — "+ token.tokenid.substring(0, 5)+'...'+token.tokenid.substring(token.tokenid.length-3, token.tokenid.length) }}
</span>
<span *ngIf="token.tokenid === '0x00'">
{{ token.token + " — "+ token.tokenid.substring(0, 5) }}
</span>
</ion-select-option>
</ion-select>
</ion-item>
...
and my observable…
this.apiService.$balance.subscribe((res: Token[]) => {
this.myTokens = res;
1 post - 1 participant