JanStevens / angular-growl-2

growl-like notifications for angularJS projects
MIT License
285 stars 97 forks source link

Sometimes single message not shown #12

Closed Djcd closed 10 years ago

Djcd commented 10 years ago

Same as

https://github.com/marcorinck/angular-growl/issues/18

function addMessage(message) {
    $scope.messages.push(message);
    if (message.ttl && message.ttl !== -1) {
        $timeout(function () {
            $scope.deleteMessage(message);
        }, message.ttl);
    }
    $scope.$apply();  // this line fix problem
}

Credits & thx to CalmNad

JanStevens commented 10 years ago

maybe its better to wrap everything in a $timeout so it will be added in the next digest cycle? Not really fan of manually triggering $apply(). I already use a $timeout for deleting the message.

I'll look into it. Thanks!

ChrisMurphy commented 10 years ago

Experiencing the same +1