I am working with a ParentService that has dependencies like:
@Injectable()
export class ParentService{
constructor(private http:Http, private customService:CustomService){}
}
Now, I want to create a ChildService that extends the ParentService:
@Injectable()
export class ChildService extends ParentService{
constructor (){
super(??) <= typescript is now prompting me to enter two parameters as per ParentService's constructor
}
}
Edit-----------------
@Injectable()
export class ParentService{
constructor(private http:Http, private customService:CustomService){
get(){this.http.get(...)}
}
}
@Injectable()
export class ChildService extends ParentService{
constructor (private http:Http, private customService:CustomService){
super(http, customService)
}
}
After setting this up, the components can use it like so:
export class Cmp {
constructor(private childService:ChildService){
this.childService.get()
}
}