Error: No Toaster Containers have been initialized to receive toasts

Error: No Toaster Containers have been initialized to receive toasts

我在我的 angular 6 应用程序中使用 angular2-toaster 稍后将使用此架构将其更新为 9 :

|___ app.module
|___ shared
     |_______shared.module
     |_______component
             |__________base.component.ts
|___ path
     |_______histograme.component

但我遇到了这个错误 No Toaster Containers have been initialized to receive toasts. 这是我的 histograme.component.ts

import { BaseComponent } from '../../shared/component/base-component';
export class histograme extends BaseComponent implements OnInit, OnDestroy {
...
error => this.showError(..)
}
...

对于我在其中加载 ToasterModule 和服务的 baseComponent

import { ToasterService, ToasterConfig } from "angular2-toaster";

@Component({
  template: 
  <toaster-container></toaster-container>
})
export class BaseComponent implements OnDestroy {
protected toasterService: ToasterService;
  protected toasterconfig: ToasterConfig = new ToasterConfig({
    positionClass: 'toast-top-right',
    showCloseButton: true
  });
protected ShowError(){
      this.toasterService.pop('error', 'Erreur', 'message');
}
}

我的 shared.module :

   imports : [ToasterModule.forRoot()],
   providers: [ToasterService],
   exports: [ToasterModule]

app.module

   imports : [ToasterModule.forRoot()],
   providers: [ToasterService],

您好,将此添加到您要显示烤面包机的 html 文件中。

<toaster-container></toaster-container>


   private toasterService: ToasterService;

    constructor(toasterService: ToasterService) {
        this.toasterService = toasterService;
    }