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

Commit 5604e59

Browse files
committed
fix(progressbar): re-expose ProgressController
- Re-expose `ProgressController` with deprecation notice Closes #4528
1 parent 92ab48e commit 5604e59

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

Diff for: src/progressbar/progressbar.js

+13-8
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ angular.module('ui.bootstrap.progressbar', [])
5858

5959
.directive('uibProgress', function() {
6060
return {
61-
restrict: 'EA',
6261
replace: true,
6362
transclude: true,
6463
controller: 'UibProgressController',
@@ -72,7 +71,6 @@ angular.module('ui.bootstrap.progressbar', [])
7271

7372
.directive('uibBar', function() {
7473
return {
75-
restrict: 'EA',
7674
replace: true,
7775
transclude: true,
7876
require: '^uibProgress',
@@ -89,7 +87,6 @@ angular.module('ui.bootstrap.progressbar', [])
8987

9088
.directive('uibProgressbar', function() {
9189
return {
92-
restrict: 'EA',
9390
replace: true,
9491
transclude: true,
9592
controller: 'UibProgressController',
@@ -111,12 +108,22 @@ angular.module('ui.bootstrap.progressbar')
111108

112109
.value('$progressSuppressWarning', false)
113110

111+
.controller('ProgressController', ['$scope', '$attrs', '$controller', '$log', '$progressSuppressWarning', function($scope, $attrs, $controller, $log, $progressSuppressWarning) {
112+
if (!$progressSuppressWarning) {
113+
$log.warn('ProgressController is now deprecated. Use UibProgressController instead.');
114+
}
115+
116+
angular.extend(this, $controller('UibProgressController', {
117+
$scope: $scope,
118+
$attrs: $attrs
119+
}));
120+
}])
121+
114122
.directive('progress', ['$log', '$progressSuppressWarning', function($log, $progressSuppressWarning) {
115123
return {
116-
restrict: 'EA',
117124
replace: true,
118125
transclude: true,
119-
controller: 'UibProgressController',
126+
controller: 'ProgressController',
120127
require: 'progress',
121128
scope: {
122129
max: '=?',
@@ -133,7 +140,6 @@ angular.module('ui.bootstrap.progressbar')
133140

134141
.directive('bar', ['$log', '$progressSuppressWarning', function($log, $progressSuppressWarning) {
135142
return {
136-
restrict: 'EA',
137143
replace: true,
138144
transclude: true,
139145
require: '^progress',
@@ -153,10 +159,9 @@ angular.module('ui.bootstrap.progressbar')
153159

154160
.directive('progressbar', ['$log', '$progressSuppressWarning', function($log, $progressSuppressWarning) {
155161
return {
156-
restrict: 'EA',
157162
replace: true,
158163
transclude: true,
159-
controller: 'UibProgressController',
164+
controller: 'ProgressController',
160165
scope: {
161166
value: '=',
162167
max: '=?',

Diff for: src/progressbar/test/progressbar.spec.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -357,11 +357,12 @@ describe('progressbar deprecation', function() {
357357
var element = $compile('<progress animate="false"><bar ng-repeat="o in objects" value="o.value" type="{{o.type}}">{{o.value}}</bar></progress>')($rootScope);
358358
$rootScope.$digest();
359359

360-
expect($log.warn.calls.count()).toBe(4);
361-
expect($log.warn.calls.argsFor(0)).toEqual(['progress is now deprecated. Use uib-progress instead.']);
362-
expect($log.warn.calls.argsFor(1)).toEqual(['bar is now deprecated. Use uib-bar instead.']);
360+
expect($log.warn.calls.count()).toBe(5);
361+
expect($log.warn.calls.argsFor(0)).toEqual(['ProgressController is now deprecated. Use UibProgressController instead.']);
362+
expect($log.warn.calls.argsFor(1)).toEqual(['progress is now deprecated. Use uib-progress instead.']);
363363
expect($log.warn.calls.argsFor(2)).toEqual(['bar is now deprecated. Use uib-bar instead.']);
364364
expect($log.warn.calls.argsFor(3)).toEqual(['bar is now deprecated. Use uib-bar instead.']);
365+
expect($log.warn.calls.argsFor(4)).toEqual(['bar is now deprecated. Use uib-bar instead.']);
365366
}));
366367
});
367368

@@ -389,8 +390,9 @@ describe('progressbar deprecation', function() {
389390
var element = $compile('<progressbar animate="false" value="value" title="foo">{{value}} %</progressbar>')($rootScope);
390391
$rootScope.$digest();
391392

392-
expect($log.warn.calls.count()).toBe(1);
393-
expect($log.warn.calls.argsFor(0)).toEqual(['progressbar is now deprecated. Use uib-progressbar instead.']);
393+
expect($log.warn.calls.count()).toBe(2);
394+
expect($log.warn.calls.argsFor(0)).toEqual(['ProgressController is now deprecated. Use UibProgressController instead.']);
395+
expect($log.warn.calls.argsFor(1)).toEqual(['progressbar is now deprecated. Use uib-progressbar instead.']);
394396
}));
395397
});
396398
});

0 commit comments

Comments
 (0)