Repository navigation
Description
Bug Report
Ionic Info
Run ionic info from a terminal/cmd prompt and paste the output below.
Ionic:
ionic (Ionic CLI) : 4.3.1 (/Users/rh/.nvm/versions/node/v8.11.4/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.0.0-beta.16
@angular-devkit/build-angular : 0.10.5
@angular-devkit/schematics : 7.0.5
@angular/cli : 7.0.5
@ionic/angular-toolkit : not installed
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 7.1.2, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 2.1.0, (and 13 other plugins)
System:
Android SDK Tools : 26.1.1 (/Users/rh/Library/Android/sdk)
ios-deploy : 1.9.2
ios-sim : 6.0.0
NodeJS : v8.11.4 (/Users/rh/.nvm/versions/node/v8.11.4/bin/node)
npm : 6.4.1
OS : macOS High Sierra
Xcode : Xcode 10.1 Build version 10B61
Describe the Bug
I have a select box in which the items contain a integer value. When this integer value is decreased below zero we try to hide the item with an *ngIf. However the item remains and the label of the ion-select does not update. This only happens when the limit of 0 is reached and the ngif is triggered.
if is add a button that ngif's the entire ion-select and toggle it on and off then it does update.
Steps to Reproduce
Steps to reproduce the behavior:
- Add several options to a ion-select
- Add *ngIf to the options
- Dynamicly change the value that your ngiffing to trigger de ngif with a button or something
- open the selectbox
- be amazed the value is still there
Related Code
<ng-container *ngFor="let productCredit of productCredits"> <ion-select-option *ngIf="productCredit.bookableCredit > 0" [value]="productCredit">{{ productCredit.label }}</ion-select-option> </ng-container> <ion-button (tap)="changedBookableCreditToLessThanZero()">Push me<ion-button>
Expected Behavior
The values in a ion-select should update visually, in my case the should dissappear because i ng-iffed them.
Additional Context
List any other information that is relevant to your issue. Stack traces, related issues, suggestions on how to fix, Stack Overflow links, forum links, screenshots, OS if applicable, etc.
Activity
d0x commentedon Nov 28, 2018
Could be related to #15716.
RHinderiks commentedon Nov 28, 2018
Could be but it does not look like that ticket has been picked up.
RHinderiks commentedon Nov 30, 2018
This is still an major issue in beta.17!
[-][4.0.0-beta.16] Conditional ion-select-option not updating[/-][+][4.0.0-beta.17] Conditional ion-select-option not updating[/+]bryce13950 commentedon Dec 4, 2018
I think you are correct. Thanks for connecting them. I think once this is fixed both should be addressed.
liamdebeasi commentedon Mar 26, 2019
Hi there,
Thanks for the issue! We have pushed a nightly build containing some fixes for loading/re-loading select options. Would you be able to try it out in your app and let me know if the issue you are running into here is fixed? (
npm i @ionic/core@dev @ionic/angular@dev)Thanks for your patience as we work to resolve this issue!
Maarcel commentedon Mar 27, 2019
Hi @liamdebeasi, unfortunately it still does not work..
liamdebeasi commentedon Mar 27, 2019
Hi @Maarcel,
Thanks for checking! Do you have a code snippet I can use to reproduce this issue?
Thanks!
Maarcel commentedon Mar 27, 2019
For example i have an array with numbers. When i change the numbers array this has no effect to the
ion-select-optionsShaneJohnsonCC commentedon Apr 1, 2019
Hey @liamdebeasi !
Is there an update on this? I'm the same exact scenario as @Maarcel, however my select options will update only if the array of numbers is greater than the previous.
So if it started at 25 and I updated it to 30, it would work. But if I then change it to 29 or lower, no update occurs...
4 remaining items
ladeiras commentedon May 2, 2019
Hi,
Anyone with an elegant workaround for this?
Thank you :)
ShaneJohnsonCC commentedon May 2, 2019
Ditto what @ladeiras asked. Just to be persistent :) A part of my app really depends on this working properly
kamalessence commentedon May 29, 2019
+1
BDominik commentedon Jul 15, 2019
Any solution on this?
I already spent more then 3 hours searching for fixes, and nothing...
david0178418 commentedon Jul 16, 2019
As a workaround, I'm just rendering two distinct select boxes that I'm toggling between:
It's brute force, but it works.
BDominik commentedon Jul 17, 2019
Thank you for your answer I did exactly the same thing. :D
Not nice but at least working.
eRendon commentedon Jul 30, 2019
other solution on this?
the solution at @david0178418 is not posible to my. need any solution because selects options are dynamics every time
fix(all): component reusage (#18963)
fix(all): component reusage (#18963)
fix(all): component reusage (#18963)
liamdebeasi commentedon Sep 4, 2019
A fix for this is available in Ionic 4.9.0. For any new bugs, please create a new issue.
Thanks!
ionitron-bot commentedon Sep 26, 2019
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.