Angular 4 primEng复选框错误

时间:2017-05-24 12:23:24

标签: angular primeng

你知道这个问题吗?当我尝试选中复选框时,会发生错误:

Checkbox.html:7 ERROR TypeError: Cannot read property 'concat' of undefined
at Checkbox.addValue (checkbox.ts:106)
at Checkbox.updateModel (checkbox.ts:76)
at Checkbox.onClick (checkbox.ts:66)
at Object.eval [as handleEvent] (Checkbox.html:7)
at handleEvent (view.ts:140)
at callWithDebugContext (services.ts:645)
at Object.debugHandleEvent [as handleEvent] (services.ts:241)
at dispatchEvent (util.ts:173)
at eval (element.ts:221)
at HTMLDivElement.eval (dom_renderer.ts:75)
at ZoneDelegate.invokeTask (zone.js@0.8.4?main=browser:398)
at Object.onInvokeTask (ng_zone.ts:253)
at ZoneDelegate.invokeTask (zone.js@0.8.4?main=browser:397)
at Zone.runTask (zone.js@0.8.4?main=browser:165)
at HTMLDivElement.ZoneTask.invoke (zone.js@0.8.4?main=browser:460)

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

此致

1 个答案:

答案 0 :(得分:4)

尝试指定binary选项:

<p-checkbox binary="true" (onChange)="onCheckboxSelected(node)"></p-checkbox>

<强> Plunker

  

二进制默认&#39; false&#39;允许选择布尔值而不是   多个值。

https://www.primefaces.org/primeng/#/checkbox