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

Commit f561aa9

Browse files
committed
fix(alert): re-expose AlertController
- Re-expose `AlertController` with deprecation message Closes #4525
1 parent 5382226 commit f561aa9

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/alert/alert.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,20 @@ angular.module('ui.bootstrap.alert')
3232

3333
.value('$alertSuppressWarning', false)
3434

35+
.controller('AlertController', ['$scope', '$attrs', '$controller', '$log', '$alertSuppressWarning', function($scope, $attrs, $controller, $log, $alertSuppressWarning) {
36+
if (!$alertSuppressWarning) {
37+
$log.warn('AlertController is now deprecated. Use UibAlertController instead.');
38+
}
39+
40+
angular.extend(this, $controller('UibAlertController', {
41+
$scope: $scope,
42+
$attrs: $attrs
43+
}));
44+
}])
45+
3546
.directive('alert', ['$log', '$alertSuppressWarning', function($log, $alertSuppressWarning) {
3647
return {
37-
controller: 'UibAlertController',
48+
controller: 'AlertController',
3849
controllerAs: 'alert',
3950
templateUrl: function(element, attrs) {
4051
return attrs.templateUrl || 'template/alert/alert.html';

src/alert/test/alert.spec.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ describe('alert deprecation', function() {
166166
element = $compile(element)($rootScope);
167167
$rootScope.$digest();
168168

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

0 commit comments

Comments
 (0)