Как сделать общий сервис машинописного текста доступным в модуле angular7? - PullRequest
2 голосов
/ 10 мая 2019

Я бы хотел, чтобы

_findEpisodeService

был доступен в моем app.module.Поэтому мне нужно указать его в массиве поставщиков @NgModule моего app.module.Проблема в том, что я не уверен, как это сделать.Пожалуйста, помогите!

// Generic service
export class ServicestackService<T> {
  constructor(private _auth: AuthenticationService, private _router: Router) {
    this._client.onAuthenticationRequired = this.onAuthenticationRequired;
  }
}

// service.ts
const req = new FindEpisode();
const _findEpisodeService = new ServicestackService<FindEpisode>(this.auth, this.router);

// App.module.ts
@NgModule({
providers: [
 {provide: JsonServiceClient, useValue: new JsonServiceClient('/')}
 ],
})
...