Topic: TS2304:Cannot find name '$'. (and also 'toastr')

Takis Koumoutsakos pro asked 7 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

We'll support Angular 2 in the future

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?

I answered you via email

Please check email for screenshots

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?

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No