primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Multiselect component with reactive forms

Open Mrtcndkn opened this issue 9 years ago • 7 comments

When multiselect component used with reactive forms it is not working.

Mrtcndkn avatar Apr 12 '17 10:04 Mrtcndkn

Is this going to be resolved with 4.0.0-Final? Multiselect isn't closing when onBlur fires.

rklempert avatar Apr 27 '17 17:04 rklempert

There is no specification, what is not working. It is working for us. Make sure you FormGroup has a correct type for MultiSelect values. It must be an array not string.

spetex avatar May 19 '17 08:05 spetex

What isn't working is after selecting a value, the dropdown modal isn't going away. It stays open and I have to click X to close it. Clicking anywhere on the page or in another input isn't hiding the the list of values. The blur event isn't firing.

rklempert avatar May 19 '17 14:05 rklempert

Do you have any errors in the console? Do you supply a correct model to the FormBuilder? Meaning the value for this field must be an array of strings since you can select multiple options. Maybe drop here some code. I have just finished a part of our app with this component with no problems, I believe we can find also a solution for you.

spetex avatar May 22 '17 09:05 spetex

The issue turns out to be related to ChangeDetectionStrategy.OnPush. Control works correctly with Default strategy. I notice similar issue with p-calendar control - I have to click a date twice for the control to close. I am using PrimeNG 4.0.1 and NG 4.1.3.

rklempert avatar May 22 '17 15:05 rklempert

I am sorry, but I was unable to reproduce the same issue. Even with onPush detection strategy and Reactive Forms and the same version of ng & primeng the Multiselect and also Datepicker works as a charm.

spetex avatar May 30 '17 07:05 spetex

Unable to replicate, please provide a test case based on plunkr below and we'll review again.

http://plnkr.co/edit/Wj39h1?p=preview

cagataycivici avatar Jun 22 '17 13:06 cagataycivici