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

fix(alert): re-expose AlertController #4525

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/alert/alert.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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.']);
}));
});