Topic: TS2304:Cannot find name '$'. (and also 'toastr')
Takis Koumoutsakos
pro
asked 6 years ago
How can I get rid of this typescript error I get in Angular2? It works fine but it's annoying.
Thank you,
Peter K
Add comment
Takis Koumoutsakos
pro
answered 6 years ago
The solution I found was to put
declare const jQuery : any;
and declare const toastr : any;
at the top of any components that use them and finally the typescript compiler stopped complaining.
I can then use them normally in the components' class methods as usual for example: jQuery(".mdb-select").material_select();
and toastr.success("Changes saved!", null, this._toasterOptions.options);
By the way, are there plans for Angular 2 support?
Bartłomiej Malanowski
staff
answered 6 years ago
Hi, Peter!
Can you tell us more? We need more details. Are there any other console logs? Is there a problem with mdb.min.js? Can you show us the code?
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
Specification of the issue
- User: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No