Toastr undefined in angularjs
I had this problem and it turns out Toastr needs JQuery to work, always make sure you include JQuery before Toastr, for example in angular.json
:
"scripts": [
"node_modules/jquery/dist/jquery.min.js", // Make sure this comes before
"node_modules/toastr/build/toastr.min.js", // this one
"node_modules/bootstrap/dist/js/bootstrap.min.js"
]
Looking at the toastr sources it looks like getOptions()
calls jQuery's $.extend()
method.
Toastr takes a dependency on jQuery, from the first line of the github readme:
toastr is a Javascript library for non-blocking notifications. jQuery is required. The goal is to create a simple core library that can be customized and extended.
Just include jquery in your master view html.
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>