Sha256: f6341088ec81cf23d851e89285722371b63c45fdfbba85a62e1120746b93b409
Contents?: true
Size: 855 Bytes
Versions: 32
Compression:
Stored size: 855 Bytes
Contents
!(angular => { 'use strict'; class AlertFlash { constructor($rootScope) { this._$rootScope = $rootScope; this.emitSuccess = _.partial(this.emit, 'success'); this.emitInfo = _.partial(this.emit, 'info'); this.emitWarning = _.partial(this.emit, 'warning'); this.emitDanger = _.partial(this.emit, 'danger'); } emit(type, message, schedule) { this._$rootScope.$broadcast(schedule ? 'scheduleAlert' : 'setAlert', { type: type, message: message }); } // use this if you need to surface raw error to user emitError(message, error) { let e = ' => ' + (_.exists(error) ? error : ''); this.emitDanger(message + e); } } AlertFlash.$inject = ['$rootScope']; angular.module('alephServices.alertFlash', []).service('AlertFlash', AlertFlash); }(angular));
Version data entries
32 entries across 16 versions & 1 rubygems