Skip to content

default value for ngModel is [] even when multiple is set to false. #293

Open
@vikas112dubey

Description

@vikas112dubey

ngModel value is set to empty array '[]' even when the mutliple flag is set to false.
I am trying to use this library for a very simple use case and i came across this issue. Below is something similar I am doing

<ngx-select-dropdown
[(ngModel)]="myModel"
[multiple]="false"
(change)="onChange($event)"
[options]="myOptions"
[config]="config">

with just above, I notice that myModel's default value is set to [] by the library. It is very unusual where the multiple selection is not required.

Expected result

Default value for the model where multiple is not defined should be set to undefined unless set otherwise.
value of myModel is undefined.

Actual result

value of myModel is []

  • Version used:
  • Browser Name and version: Chrome - 3.3.1
  • Operating System and version: Windows 10 Enterprise
  • Link to your project:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions