Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70429

Ion-Select - Choosing a default value

$
0
0

@eliasminima wrote:

Hi, I have been trying to figure out a way to add a default value for my . I have an array with a js interface.

<ion-select 
              interface = 'alert'
              class="t-select"
              placeholder = "Select your item"
              [(ngModel)]="selectedItem">
          <ion-select-option *ngFor="let item of itemArr; let i = index" value="{{item.id}}" class="t-option" >
            {{ item.token  + ' <' + item.id.substring(0, 12) + '>'  }} 
          </ion-select-option>
        </ion-select>
  1. I have tried adding [value]=“selectedItem()” which returns the item I want.
  2. I tried the compareFn.
  3. I tried the directory [ngValue] in .

All I want is for my to choose the first item in the itemArr if nothing is passed to it.

And I also am choosing the item from another page, and then adding a slider on it so that I can choose an option and pass it to my other page using params. isn’t defaulting to that id either…

Any help would be appreciated!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70429

Trending Articles



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