Closed tlvince closed 9 years ago
Hello,
I've edit it using my settings from the code pen examples. It seems that there is a bug (or not dont know yet) that you should use the growls as an action or result of something.
http://plnkr.co/edit/SLWeLg8gOzXWodatWng3?p=preview
I've added a button that can be clicked and this toggles a growl notification. I dont know in what usecase you should instantly show a growl when the controller is initialized (something odd happens then). I can look into it
Yeah, my example is contrived (a reduced test case to demonstrate the bug), though I'll frequently trigger a growl from a service (i.e. not from a user-facing interaction) e.g. when an XHR call has failed.
+1, I am seeing this too.
same error
TypeError: Cannot read property 'messages' of undefined
at addMessage (angular-growl.js:298)
at broadcastMessage (angular-growl.js:193)
at sendMessage (angular-growl.js:222)
at Object.success (angular-growl.js:234)
at regionView.js:52
at processQueue (angular.js:13075)
at angular.js:13091
at Scope.$get.Scope.$eval (angular.js:14291)
at Scope.$get.Scope.$digest (angular.js:14107)
at Scope.$get.Scope.$apply (angular.js:14395)
I think this is a loading issue or async issue, it works with a button or a server response, I'll look into it this week
I've run in to this issue when unit testing my code that calls the growlMessages service without the directive.
Essentially initDirective is never called so this.directives[referenceId] is undefined.
In my unit tests I had to do something like:
beforeEach(inject(function ($injector) {
var $compile = $injector.get('$compile');
var element = angular.element('<div growl></div>');
$compile(element)($scope);
}));
+1, running into this as well.
+1 I'm getting this error too.
+1 ran into this while unit testing too
+1
Any idea what's going on here? plunkr.