goetzrobin / spartan

Cutting-edge tools powering Angular full-stack development.
https://spartan.ng
MIT License
1.1k stars 121 forks source link

fix(select): ngModel values are displayed #238

Closed elite-benni closed 3 months ago

elite-benni commented 3 months ago

multiple selections are not cleared after selecting additional option

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

Which package are you modifying?

What is the current behavior?

The value bound to [(ngModel)] is not displayed correctly in the control if it is not a string or a array.

When multiple is true and a value is provided via ngModel When then addtional option is selected, the first options are not checked anymore. In this example, 1,3 are preselected by ngModel and 4 was clicked.

Closes #237

What is the new behavior?

Values set by ngModel are set correctly also when it is a number.

For multiple Select, the initialValues are set always when the Value changes from the ControlValueAccessor, because otherwise, Values would not be set correct if additional options are selected.

Does this PR introduce a breaking change?

Other information