primeng icon indicating copy to clipboard operation
primeng copied to clipboard

[Bug] Checkbox state does not follow its ngModel value

Open Etchelon opened this issue 9 years ago • 3 comments

I'm submitting a ... (check one with "x") [ x] bug report => Search github for a similar issue or PR before submitting [ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap [ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Plunkr Case (Bug Reports) http://plnkr.co/edit/DGWj95FlcDFsfecaHucC?p=preview

Current behavior Checking another checkbox should set all others to unchecked state and set the clicked one to checked state, programmatically, but does NOT uncheck the others even if their ngModel is set to false.

Expected behavior Other checkboxes should be unchecked programmatically.

Minimal reproduction of the problem with instructions See the plunkr, very very easy,

  • Angular version: 2.0.X 2.4.8

  • PrimeNG version: 2.0.X 2.0.0

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ] All

  • Language: [all | TypeScript X.X | ES6/7 | ES5] Typescript >= v2

Etchelon avatar Feb 27 '17 09:02 Etchelon

I dont think its an issue, I think its a bug in your code in the plunker.

You bind the checkboxes to "checked" property of the your model items but when updating values you change the "isChecked" property instead so that change is never detected by the component.

I have forked your plunker and updated some code and it seems to work fine now - please have a look.

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

external-olgierd avatar Feb 27 '17 11:02 external-olgierd

You are right, I mistyped the code in the plunkr. Fixed anyway, I was improperly using _.each from Lodash to set checked to false for all items.

Etchelon avatar Feb 27 '17 14:02 Etchelon

@ external-olgierd ... Thanks ... you saved my life!

mandeepsapkota avatar Aug 08 '17 07:08 mandeepsapkota