Most of the time you want to flash the message after the route changed. angular-toastr-flash adds support for flashing to angular-toastr.
$ bower install angular-toastr-flash
.config(['flashConfig', function(flashConfig) {
flashConfig.routeStateChanges = ['$stateChangeSuccess'];
}])
Add angular-toastr-flash to your module dependencies: :
angular.module('app', ['angular-toastr-flash']);
Module api for toastr: :
// In all calls only first argument is required. Toasts get displyed after successful route change event.
flash.info('Info message');
flash.success('Success message', 'Success title');
flash.warning('Warning message', 'Warning title', {}); // This argument is for angular-toastr-options
flash.error('Error message', 'Error title');
Module api for custom callbacks: :
flash.callback(function() {
// your code goes here.
});
Clearing flash buffer from delayed toasts and custom callbacks: ::
flash.clear();