Sha256: 129935a4fb69b5b04ce2706284bc7d79a1eb223df4499cfc4d2c52d49bd45637
Contents?: true
Size: 1.52 KB
Versions: 45
Compression:
Stored size: 1.52 KB
Contents
/** * @ngdoc directive * @name Bastion.components.directive:bstAlerts * * @description * Simple directive for encapsulating alert displays. * * @example * <pre> * <div bst-alerts * successMessages="successMessages" * errorMessages="errorMessages"> * </div> */ angular.module('Bastion.components').directive('bstAlerts', function () { return { templateUrl: 'components/views/bst-alerts.html', scope: { successMessages: '=', infoMessages: '=', warningMessages: '=', errorMessages: '=' }, link: function (scope) { scope.alerts = {}; scope.types = ['success', 'info', 'warning', 'danger']; function handleMessages(type, messages) { scope.alerts[type] = messages; } scope.$watch('successMessages', function (messages) { handleMessages('success', messages); }, true); scope.$watch('infoMessages', function (messages) { handleMessages('info', messages); }, true); scope.$watch('warningMessages', function (messages) { handleMessages('warning', messages); }, true); scope.$watch('errorMessages', function (messages) { handleMessages('danger', messages); }, true); scope.closeAlert = function (type, index) { scope.alerts[type].splice(index, 1); }; } }; });
Version data entries
45 entries across 45 versions & 1 rubygems