我正在使用ngx-toastr或ng6-toastr-notifications,但在为我的应用程序提供服务时出现错误,无法提供服务

时间:2019-03-28 05:58:37

标签: angular

请使用当我无法使用的烤面包机模块时遇到此错误。

  

Angular CLI:7.3.7

     

节点:11.8.0

     

操作系统:Linux x64

     

角度:7.2.11

     

错误   node_modules / ng2-toastr / src / toast-container.component.d.ts(1,48):   错误TS2305:模块'“ ../../@angular/core/core”'没有导出   成员“ AnimationTransitionEvent”。

appModule.ts
import { ToastrModule } from "ngx-toastr";
imports: [
 BrowserModule,
 HttpClientModule,
 FormsModule,
 BrowserAnimationsModule,
 ToastrModule.forRoot({
 positionClass: "toast-top-right",
 timeOut: 1000
})
],

component.ts
import { ToastrService } from "ngx-toastr";
constructor(
private userservice: UsersService,
private toastr: ToastrService
) {}
this.toastr.success("User created successfully.");

1 个答案:

答案 0 :(得分:0)

错误显示ng2-toastr,因此您可能需要将ng2-toastr替换为ngx-toastr。

请参考给定的link添加ngx-toaster。

否则,您可以按照给定的视频link