Sha256: 3c4a8b041df0184e1ed1376b1c3512b9d84db38039a97896f149de57428ee69c

Contents?: true

Size: 1.86 KB

Versions: 8

Compression:

Stored size: 1.86 KB

Contents

angular.module('ui.bootstrap.alert', [])

.controller('UibAlertController', ['$scope', '$attrs', '$interpolate', '$timeout', function($scope, $attrs, $interpolate, $timeout) {
  $scope.closeable = !!$attrs.close;

  var dismissOnTimeout = angular.isDefined($attrs.dismissOnTimeout) ?
    $interpolate($attrs.dismissOnTimeout)($scope.$parent) : null;

  if (dismissOnTimeout) {
    $timeout(function() {
      $scope.close();
    }, parseInt(dismissOnTimeout, 10));
  }
}])

.directive('uibAlert', function() {
  return {
    controller: 'UibAlertController',
    controllerAs: 'alert',
    templateUrl: function(element, attrs) {
      return attrs.templateUrl || 'template/alert/alert.html';
    },
    transclude: true,
    replace: true,
    scope: {
      type: '@',
      close: '&'
    }
  };
});

/* Deprecated alert below */

angular.module('ui.bootstrap.alert')

  .value('$alertSuppressWarning', false)

  .controller('AlertController', ['$scope', '$attrs', '$controller', '$log', '$alertSuppressWarning', function($scope, $attrs, $controller, $log, $alertSuppressWarning) {
    if (!$alertSuppressWarning) {
      $log.warn('AlertController is now deprecated. Use UibAlertController instead.');
    }

    angular.extend(this, $controller('UibAlertController', {
      $scope: $scope,
      $attrs: $attrs
    }));
  }])

  .directive('alert', ['$log', '$alertSuppressWarning', function($log, $alertSuppressWarning) {
    return {
      controller: 'AlertController',
      controllerAs: 'alert',
      templateUrl: function(element, attrs) {
        return attrs.templateUrl || 'template/alert/alert.html';
      },
      transclude: true,
      replace: true,
      scope: {
        type: '@',
        close: '&'
      },
      link: function() {
        if (!$alertSuppressWarning) {
          $log.warn('alert is now deprecated. Use uib-alert instead.');
        }
      }
    };
  }]);

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
active_record_survey_api-0.0.19 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/src/alert/alert.js
active_record_survey_api-0.0.18 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/src/alert/alert.js
active_record_survey_api-0.0.17 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/src/alert/alert.js
active_record_survey_api-0.0.14 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/src/alert/alert.js
active_record_survey_api-0.0.12 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/src/alert/alert.js
active_record_survey_api-0.0.11 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/src/alert/alert.js
active_record_survey_api-0.0.7 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/src/alert/alert.js
active_record_survey_api-0.0.6 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/src/alert/alert.js