Search code examples
javascripttoastr

Toastr throws TypeError for toastr.info('msg')


I am trying out toastr but I keep getting a strange TypeError that does not make any sense to me.

TypeError: Cannot read property 'extend' of undefined
at getOptions (http://localhost:3000/bower_components/toastr/toastr.js:391:25)

I had my project scaffolded with yeoman gulp-angular and properly injected toastr into controller where I want to test it. Line I tried is simply:

toastr.info('A message.');

toastr is present in the page - inserted by a gulp task. How to find out what went wrong here?


Solution

  • jQuery library might not be included. toastr getOptions method is trying to extend the config that was passed in when you initialized toastr.