ngx-toastr, Toast not showing in Angular 7

后端 未结 16 1727
清歌不尽
清歌不尽 2021-02-01 12:37

I\'m currently developing a web app using Angular 7. I wanted to include ngx-toastr to send notifications to users but it isn\'t working as expected. When I trigger a toast noth

16条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-01 13:28

    An alternative to Keenan Diggs' answers is providing an additional style class in the ToastrModule definition which sets opacity to 1. IMO this is a bit more clear what we're trying to achieve here and also doesn't have to depend on #toast-container.

    app.module.ts:

    ToastrModule.forRoot({
      toastClass: 'toast toast-bootstrap-compatibility-fix'
    }),
    

    Don't forget the original toast class.

    Your (s)css file:

    .toast-bootstrap-compatibility-fix {
      opacity:1;
    }
    

提交回复
热议问题