Wrapping 3rd party library in Angular Service #949

Closed
opened 2025-08-09 17:18:17 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @paddyza on 3/8/2017

I am trying to add toastr to my project (https://codeseven.github.io/toastr/)

I have done the following:

  1. Added toastr to package.json. Package was successfully downloaded and added to node_modules directory.
  2. Added "toastr" to webpack.vendor.config.js
  3. Ran "webpack --config webpack.config.vendor.js" successfully.
  4. Added and registered my new ToastrService in app.module.
  5. Imported the ToastrService into the Component I want to call it from.

When I try access a method in ToastrService from the Component, I get an error saying "toastr is not defined". Are there any steps I may have missed? I did a search for "toastr" in vendor.js, and was able to locate the code relating to it.

Thanks,
Patrick

*Originally created by @paddyza on 3/8/2017* I am trying to add toastr to my project (https://codeseven.github.io/toastr/) I have done the following: 1. Added toastr to package.json. Package was successfully downloaded and added to node_modules directory. 2. Added "toastr" to webpack.vendor.config.js 3. Ran "webpack --config webpack.config.vendor.js" successfully. 4. Added and registered my new ToastrService in app.module. 5. Imported the ToastrService into the Component I want to call it from. When I try access a method in ToastrService from the Component, I get an error saying "toastr is not defined". Are there any steps I may have missed? I did a search for "toastr" in vendor.js, and was able to locate the code relating to it. Thanks, Patrick
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#949
No description provided.