Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Commit

Permalink
fix(alert): re-expose AlertController
Browse files Browse the repository at this point in the history
- Re-expose `AlertController` with deprecation message

Closes #4525
  • Loading branch information
wesleycho committed Oct 3, 2015
1 parent 5382226 commit f561aa9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
13 changes: 12 additions & 1 deletion src/alert/alert.js
Expand Up @@ -32,9 +32,20 @@ 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: 'UibAlertController',
controller: 'AlertController',
controllerAs: 'alert',
templateUrl: function(element, attrs) {
return attrs.templateUrl || 'template/alert/alert.html';
Expand Down
5 changes: 3 additions & 2 deletions src/alert/test/alert.spec.js
Expand Up @@ -166,7 +166,8 @@ describe('alert deprecation', function() {
element = $compile(element)($rootScope);
$rootScope.$digest();

expect($log.warn.calls.count()).toBe(1);
expect($log.warn.calls.argsFor(0)).toEqual(['alert is now deprecated. Use uib-alert instead.']);
expect($log.warn.calls.count()).toBe(2);
expect($log.warn.calls.argsFor(0)).toEqual(['AlertController is now deprecated. Use UibAlertController instead.']);
expect($log.warn.calls.argsFor(1)).toEqual(['alert is now deprecated. Use uib-alert instead.']);
}));
});

0 comments on commit f561aa9

Please sign in to comment.