Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48980

Ion-select changes resets my whole form

$
0
0

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 + " &mdash; "+ token.tokenid.substring(0, 5)+'...'+token.tokenid.substring(token.tokenid.length-3, token.tokenid.length) }}
          </span>
          <span *ngIf="token.tokenid === '0x00'">
            {{ token.token + " &mdash; "+ 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

Read full topic


Viewing all articles
Browse latest Browse all 48980

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>