I am working on growl.info() on angularjs and I have a question. How can I check if a growl exists in view (screen), when trying to add a new one? If a new one tries to be shown the previous one must be erased from screen. The code in controller is this:
$scope.showInfo= function () {
var info = "test";
growl.info(message.replace("{0}", info), {
ttl: 50000
});
};
but note that ttl is important too. If no new growl tries to be shown, the first must live for a long period. Thank you in advance!
Firslty we add a public variable:
$scope.growlMessge = null;
and then we check if it has already a value (just to destroy it), before giving the new one
$scope.showInfo= function () {
if ($scope.growlMessage != null) {
$scope.growlMessage.destroy();
}
var info = "test";
$scope.growlMessage = growl.info(message.replace("{0}", info), {
ttl: 50000
});
};