Skip to content

Commit

Permalink
Fixed a bug in the destroyAllMessages function.
Browse files Browse the repository at this point in the history
The destroyAllMessages was not setting the loop counter correctly and
would error if there was only 1 message in the array.
  • Loading branch information
royerboat committed Jan 15, 2015
1 parent 1763c0e commit b7946ce
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/growlMessageService.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ angular.module("angular-growl").service("growlMessages", ['$sce', '$timeout', fu
};

this.destroyAllMessages = function (referenceId) {
var messages = this.getAllMessages(referenceId),
i = messages.length;
for (i - 1; i >= 0; i--) {
var messages = this.getAllMessages(referenceId);
for (var i = messages.length - 1; i >= 0; i--) {
messages[i].destroy();
}
if (this.directives[referenceId]) {
Expand Down

0 comments on commit b7946ce

Please sign in to comment.