bug: Can not selet ion-select when FormControl setValue or Show blank but actually selected
See original GitHub issueBug Report
Can not select ion-select when FormControl setValue . Actually it’s selected but on display is blank. It’s will be not blank if we give setTimeOut on it like this.
Blank on ion-select
this.myForm.controls.City.setValue(this.city_data[i].id);
Not Blank on ion select
setTimeout( () => {
this.myForm.controls.City.setValue(this.city_data[i].id);
});
This only happen on data ion-select who data get from server using for. Data item who already write on html will running good when using setValue. Example
<ion-select (ngModelChange)="getStates($event)" formControlName="Country" [class.invalid]="!myForm.controls['Country'].valid && (myForm.controls['Country'].dirty || submitAttempt)">
<ion-select-option value="{{dm1.id}}" *ngFor="let dm1 of country_data">{{dm1.name}}</ion-select-option>
</ion-select>
Ionic version: [x] 4.9.1
Angular version: [x] 8.2.6
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:6 (1 by maintainers)
Top Results From Across the Web
bug: Can not selet ion-select when FormControl setValue or ...
Can not select ion-select when FormControl setValue . Actually it's selected but on display is blank. It's will be not blank if we...
Read more >Cant set value to select in Reactive Form - Stack Overflow
Actually setValue and patchValue are seems working here. We check that with below approach.. this.tourPageForm.get('accomadation').
Read more >Uncaught TypeError: Cannot read property of null - iDiallo
This error occurs when you read a property or call a method on a null object . That's because the DOM API returns...
Read more >A thorough exploration of Angular Forms - InDepth.Dev
A FormControl can be considered standalone if it does not belong to an AbstractControl tree. As a result, it will be completely independent,...
Read more >ngOptions - AngularJS: API
When an item in the <select> menu is selected, the array element or object property represented by the selected option will be bound...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m having similar issue ion-select where options come from server request don’t show selected value but when I click on it it update and show the correct selected value
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.