Success messages will, by default, close automatically after 3 seconds. To close a message just click on the message body or close button. All features and configuration options are documented in the readme.
flashMessage.success('Your message here.');
flashMessage.error('Your message here.');
flashMessage.warning('Your message here.');
flashMessage.info('Your message here.');
flashMessage.info('Your message here.').then(function () {
// Anything you want to do when the message is closed.
});
Full Feature Flash Message (Please check the documentation.) Show / Hide code$scope.fullFeatureFlashMessage = function () {
var data = { // Your data object, this can be anything you like.
title : 'Full feature message',
message : 'But wait... there is more! Objects are also supported too.',
note : 'You only have to modify the template. See the section "Configuration" in the readme file.'
},
persist = 1, // The number of events that your message has to 'survive'.
delay = 6000, // The time your message is visible in miliseconds. (Now 6 seconds.) Use a number < 1 to disable.
showClose = false, // Hide the close button. (Note that this feature is located in the template. When using a custom design make sure to use: ng-if="msg.showClose")
template = 'custom-message.html', // Specify your custom template.
clickToClose = false; // Disable the click event on the message(body) (This option will not affect the close button.)
flashMessage.warning(data, persist, delay, showClose, template, clickToClose).then(function () {
alert('All features are shown now... Please also check the configuration documentation in the readme file.');
});
};
Custom flash message type (Please check the documentation.) Show / Hide code// Definition in app config
flashMessageProvider.setType('myMissingMessageType');
// In controller
flashMessage.myMissingMessageType('Your message here.');
Remove flash message after 3 events (By default pagiation events are used.) Show / Hide code flashMessage.warning('Your message here.', 3);