Unable to import toastr module with Angular 2

前端 未结 1 1029
栀梦
栀梦 2021-01-14 15:34

I am creating an Angular 2 application with version 2.0.0-alpha.46 and I trying to import the toastr module.

I have downloaded the library and also downloaded the de

相关标签:
1条回答
  • 2021-01-14 16:21

    I think that the toastr.min.js file doesn't contain a module at all. My understanding is that TypeScript definition files help you to define the methods and structures used by the toastr library. This is helpful within your IDE for code completion. This definition file doesn't actually create a module that can be use at runtime...

    This means that you can use directly the toastr object directly without having to import it like this: import * as toastr from '...';.

    Here is the corresponding plunkr: https://plnkr.co/edit/wzdoisKBrZYTeSX8r7Nd?p=preview.

    Hope that makes sense. Thierry

    0 讨论(0)
提交回复
热议问题