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

Ion-picker with [(ngModel)]

$
0
0

Hello,

I’m using Ionic 8 with Angular 18. In a new component, I’m using ion-picker for the first time. I’m trying to bind a variable to it with [(ngModel)]. That doesn’t seem to work. I tried it like this:

<ion-picker [(ngModel)]="test">
    <ion-picker-column>
        <ion-picker-column-option value="test 1">Test 1</ion-picker-column-option>
        <ion-picker-column-option value="test 2">Test 2</ion-picker-column-option>
        <ion-picker-column-option value="test 3">Test 3</ion-picker-column-option>
    </ion-picker-column>
</ion-picker>

I also tried to put ngModel on ion-picker-column. In both cases I get the following error in the console:

ERROR TypeError: Cannot read properties of null (reading ‘writeValue’)

That probably means that ion-picker doesn’t support ngModel. Is that correct? If yes, is there a special reason? ion-datetime supports it.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 70920

Trending Articles



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