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

Commit 3aa9841

Browse files
committed
fix(timepicker): re-expose TimepickerController
- Re-expose `TimepickerController` with deprecation notice Closes #4531
1 parent 435924f commit 3aa9841

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/timepicker/test/timepicker.spec.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1752,7 +1752,8 @@ describe('timepicker deprecation', function() {
17521752
element = $compile(element)($rootScope);
17531753
$rootScope.$digest();
17541754

1755-
expect($log.warn.calls.count()).toBe(1);
1756-
expect($log.warn.calls.argsFor(0)).toEqual(['timepicker is now deprecated. Use uib-timepicker instead.']);
1755+
expect($log.warn.calls.count()).toBe(2);
1756+
expect($log.warn.calls.argsFor(0)).toEqual(['TimepickerController is now deprecated. Use UibTimepickerController instead.']);
1757+
expect($log.warn.calls.argsFor(1)).toEqual(['timepicker is now deprecated. Use uib-timepicker instead.']);
17571758
}));
17581759
});

src/timepicker/timepicker.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -386,11 +386,22 @@ angular.module('ui.bootstrap.timepicker')
386386

387387
.value('$timepickerSuppressWarning', false)
388388

389+
.controller('TimepickerController', ['$scope', '$attrs', '$controller', '$log', '$timepickerSuppressWarning', function($scope, $attrs, $controller, $log, $timepickerSuppressWarning) {
390+
if (!$timepickerSuppressWarning) {
391+
$log.warn('TimepickerController is now deprecated. Use UibTimepickerController instead.');
392+
}
393+
394+
angular.extend(this, $controller('UibTimepickerController', {
395+
$scope: $scope,
396+
$attrs: $attrs
397+
}));
398+
}])
399+
389400
.directive('timepicker', ['$log', '$timepickerSuppressWarning', function($log, $timepickerSuppressWarning) {
390401
return {
391402
restrict: 'EA',
392403
require: ['timepicker', '?^ngModel'],
393-
controller: 'UibTimepickerController',
404+
controller: 'TimepickerController',
394405
controllerAs: 'timepicker',
395406
replace: true,
396407
scope: {},

0 commit comments

Comments
 (0)