Extending components in PrimeNG

2019-06-12 15:26发布

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条回答
等我变得足够好
2楼-- · 2019-06-12 15:53

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); }

查看更多
登录 后发表回答