TypeError: newToast.scope.init is not a function
See original GitHub issueI’m using angular-toastr in my project and i’ve got this error, when first toastr appears.
TypeError: newToast.scope.init is not a function
File http://page.com/js/vendor.js line 73525 col 15 in _notify/</</<
File http://page.com/js/vendor.js line 22503 col 27 in processQueue
File http://page.com/js/vendor.js line 22519 col 27 in scheduleProcessQueue/<
File http://page.coml/js/vendor.js line 14151 col 7 in completeOutstandingRequest
File http://page.com/js/vendor.js line 14539 col 7 in Browser/self.defer/timeoutId<
Unfortunately, this error appear always on server (for first toastr) and only one on my local machine.
This is my config:
angular.extend(toastrConfig, {
closeButton: false,
iconClasses: {
info: 'toast-message',
warning: 'toast-cart'
},
templates: {
toast: 'templates/common/services/alersts_service/alertsServ.html'
}
});
I’m inlcuding angular-toastr.tpls.js script in my html files.
Issue Analytics
- State:
- Created 8 years ago
- Comments:43 (20 by maintainers)
Top Results From Across the Web
TypeError: showToastrMessage.init is not a function
What are you trying do do? If you want to run showToastrMessage function, try showToastrMessage() instead of showToastrMessage.init() .
Read more >How to resolve the error 'TypeError: undefined is not a function ...
Therefore you shouldn't use the instance method like this: var ap = new Ansprechpartner();. $scope.nameDuplicates = ap.$searchByName(.
Read more >AngularJS 1.4.x and Angular Toastr custom properties not ...
$scope.showCustomToast = function() { toastr.error('This toast should be in the ... container).then(function() { newToast.scope.init(); }); } else { var ...
Read more >Getting Error "Toastr Is Not A Function Error" When Trying To ...
I'm using angulartoastr in my project and i've got this error when first toastr appears.TypeError: newToast.scope.init is not a function. Step 2: Triggering...
Read more >How to fix "Uncaught TypeError: x is not a function" in JavaScript
JS Casts 01 - How to fix "Uncaught TypeError : x is not a function " in JavaScript.Visit https://javascriptcasts.com/episodes/01 for a summary ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
THE FIX:
I’ve had this problem for ages and just ignored it, but I finally got to it. Someone here even pointed it out and it worked. $templateCache.
you’ll notice that I changed the config so toast.html and progressbar.html have no paths.
Then I force toast.html and progressbar.html into the cache.
I think the problem was simply that the template just didn’t load fast enough. Was driving me nuts, because I couldn’t get it to happen on my local server, but the production machine had the bug.
Anyway, if you’re having trouble, try just cutting and pasting that code into yours. If it works, boom, you’re done.
It should be fixed, but apparently not. Would you be able to reproduce this in a plunker or a little project at github? I would like to try.