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

Ion-select and default values (ionic 4)

$
0
0

@Maestropikal wrote:

Hi all,

sorry for surely a dumb question already answered 1000 times maybe, but I washed the net and forums and didn’t have a CLEAR and SIMPLE answer to my quest :cry:

What I want to do :

  • use ion-select selector
  • use [(NgModel)] to store selected value
  • with options in an *ngFor loop
  • set as default value selected one of these values

I tried to use “selected” attribute in ion-select-option but does not seem to work
I tried to use the compareWith feature but didn’t manage to understand how to have it fulfill the default value stuff.
I tried to use the “value” attribute in ion-select, didn’t work either

I noticed that when I don’t use the [(NgModel)] stuff, the “value” attribute works just fine to set the default selected value, but I don’t get the utility of having a selector without storing back the selected value (or maybe there is another way, i m not an Angular guru)

Thanks forward for your help, if you could give a clear example, explained like for a 5-year old child it would be perfect.

Have a nice day all :slight_smile:

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



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