Closed enapupe closed 9 years ago
Now you can use replaceMessage option.
The example using this option:
Notification({message: "Refreshing...", delay: 0});
SomeService.regenerateAPIKey().then(function(){
Notification.success({
message: "API Key successfully regenerated.",
replaceMessage: true
});
});
First message will be replaced by the success message when regenerateAPIKey() promise will be resolved.
I don't know.. Since you don't have controll over which notification one you are replacing, I think it may replace the wrong message . What happens if another promise triggers in the mean time?
Ok. I got it. My approach kills all the currently shown messages and shows new message. But you suggest to provide possibility to kill one specific message. I'll implement this feature.
Now in v0.0.11 (379a07d89a26978a0f8be1a7d46872abf88eb1a5) you can use this functionality.
var test = Notification("Refreshing.....");
SomeService.regenerateAPIKey().then(function(){
Notification("API Key sucessfully regenerated.");
test.then(function(notification){
notification.kill(true);
});
});
I think would be nice if Notification could return a object with it's configuration, methods, etc..
I would like to kill a notification if a ajax request is done. To this date there's no way to do this.
The necessary modification (draft) is proposed at https://github.com/alexcrack/angular-ui-notification/compare/master...enapupe:returnNotification?expand=1
Do you think this improvement is possible?
An example of use would be: