Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
145
How to apply a default value to an IgxSelectComponent
posted
Hi, what is the recommended way to apply a default value to an IgxSelectComponent using a template like this?:
<igx-select type="string" formControlName="classification">
    <label igxLabel>Classification</label>
    <igx-select-item *ngFor="let classification of classifications$ |async" [value]="classification">
        {{classification}}
    </igx-select-item>
</igx-select>
Thanks in advance!
  • 60
    Offline posted

    Hello Frank,


    Thank you for contacting Infragistics Support.


    I have been looking into your question and prepared a small sample that you might consider useful. It could be found here. Following the guidelines provided in the Template section of the Select topic, I am using the [(ngModel)] and I defined a global variable where is stored the default value in order to achieve your requirement.


    Please test the sample on your side and let me know how it behaves. If this is not an accurate demonstration of what you are trying to achieve please feel free to modify it and send it back to me along with steps to reproduce. Alternatively, if the behavior cannot be replicated please feel free to provide your own small isolated sample. Remove any external dependencies and code that is not directly related to the issue, zip your application and attach it in this case.


    Having a working sample on my side, which I can debug, is going to be very helpful in finding the root cause of this behavior.


    Thank you for your cooperation.


    Looking forward to hearing from you.


    Regards,
    Malin Hadzhiev
    Entry Level Software Developer
    Infragistics