Additional Information:
I have a base.component.ts which calls the MonitoringService:
import { MonitoringService } from './services/monitoring.service';
import { Component, ReflectiveInjector, OnInit } from '@angular/core';
@Component({
template: ''
})
export class BaseComponent
{
constructor(private _monitoringService: MonitoringService)
{
const injector = ReflectiveInjector.resolveAndCreate([
MonitoringService
]);
this._monitoringService = injector.get(MonitoringService);
}
Then I extent other components with Base.component.ts to use the MonitorningService as below. For example home.component.ts uses MonitoringService as below:
import { Home } from '../models/home';
import { BaseComponent } from '../base.component';
import { MonitoringService } from '../services/monitoring.service';
@Component({
selector: 'app-home',
templateUrl: './home.component.html'
})
export class HomeComponent extends BaseComponent implements OnInit
{
home: Home;
constructor(private homeService: HomeService, private _monitorningService: MonitoringService)
{
super(_monitorningService);
}