typescript - How do I extend a class thats using direct injection -
hopefully should relatively easy question of out there...
i trying extend component not sure how deal constructor method of new component.
below base component
import { component, oninit } '@angular/core'; import { controlsservice } '../controls.service' @component({ moduleid : module.id, selector : 'app-base', templateurl : 'base.component.html', styleurls : ['base.component.css'], providers : [controlsservice] }) export class basecomponent implements oninit { constructor(_controlservice:controlsservice) {} ngoninit() { // console.log(this._controlservice.getcontrolbyid('b5ee385d-1d6a-335a-1e94-2f857428a6fb')) } }
and below new component
import { component, oninit } '@angular/core'; import { mdtoolbar } '@angular2-material/toolbar'; import { mdicon, mdiconregistry} '@angular2-material/icon'; import { panelcomponent } '../panel/panel.component' import { basecomponent } '../base/base.component' import { controlsservice } '../controls.service' @component({ moduleid : module.id, selector : 'app-workbench', templateurl : 'workbench.component.html', styleurls : ['workbench.component.css'], directives : [mdtoolbar,mdicon,panelcomponent], providers : [mdiconregistrym,controlsservice] }) export class workbenchcomponent extends basecomponent implements oninit{ workbenchtitle = "selection category " constructor(_controlservice:controlsservice) { super(this._controlservice) } ngoninit() { } }
i need _controlservice in base component service retrieve controls parameters, seems if create service in base components constructor method, have pass base component new component. prefer not seems may have to.
the error being returned me is: (17, 21): supplied parameters not match signature of call target.
could point me in right direction on how extend base component.
thanks!
the this.
invalid
export class workbenchcomponent extends basecomponent implements oninit{ constructor(_controlservice:controlsservice) { // super(this._controlservice) // should super(_controlservice) } }
Comments
Post a Comment