Examples

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.

Trigger Messages

Simple Messages

Success flash message (Will disappear after 3 seconds by default configuration.)
Error flash message
Warning flash message
Info flash message

flashMessage.success('Your message here.');
flashMessage.error('Your message here.');
flashMessage.warning('Your message here.');
flashMessage.info('Your message here.');

Advanced Messages

Info flash message with promise (Resolve the promise by clicking on the message or close button.) Show / Hide code
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);

Directive

Show all message types

Show only success and info messages

Show messages in custom wrapper via directive