Extending components in PrimeNG

99封情书 提交于 2019-12-23 04:32:30

问题


I would like to extend a component in PrimeNg using Angular 2. I tried a simple example to extend the MultiSelect component and was unsuccessful. I am getting the below error "No provider for DomHandler!" in the browser console. Has anyone tried extending the PrimeNg components. Is it even possible.

The exact exception:<> "EXCEPTION: Error in ./AppComponent class AppComponent - inline template:0:0 caused by: No provider for DomHandler!
ErrorHandler.handleError @ error_handler.js:54
(anonymous) @ application_ref.js:261
ZoneDelegate.invoke @ zone.js:330
onInvoke @ ng_zone.js:273
ZoneDelegate.invoke @ zone.js:329
Zone.run @ zone.js:126
(anonymous) @ zone.js:679
ZoneDelegate.invokeTask @ zone.js:363
onInvokeTask @ ng_zone.js:264
ZoneDelegate.invokeTask @ zone.js:362
Zone.runTask @ zone.js:166
drainMicroTaskQueue @ zone.js:529 "


回答1:


It is possible, but there is no way to extend template.

To fix this error you need to provide in constructor all dependencies for MultiSelect component:

constructor(el: ElementRef, domHandler: DomHandler, renderer: Renderer, differs: IterableDiffers) { super(el, domHandler, renderer, differs); }



来源:https://stackoverflow.com/questions/42535485/extending-components-in-primeng

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!