diff --git a/src/timepicker/test/timepicker.spec.js b/src/timepicker/test/timepicker.spec.js index ab22a26b3a..93dac89664 100644 --- a/src/timepicker/test/timepicker.spec.js +++ b/src/timepicker/test/timepicker.spec.js @@ -1752,7 +1752,8 @@ describe('timepicker deprecation', function() { element = $compile(element)($rootScope); $rootScope.$digest(); - expect($log.warn.calls.count()).toBe(1); - expect($log.warn.calls.argsFor(0)).toEqual(['timepicker is now deprecated. Use uib-timepicker instead.']); + expect($log.warn.calls.count()).toBe(2); + expect($log.warn.calls.argsFor(0)).toEqual(['TimepickerController is now deprecated. Use UibTimepickerController instead.']); + expect($log.warn.calls.argsFor(1)).toEqual(['timepicker is now deprecated. Use uib-timepicker instead.']); })); }); diff --git a/src/timepicker/timepicker.js b/src/timepicker/timepicker.js index 5d9e076f6b..d69d98e2d8 100644 --- a/src/timepicker/timepicker.js +++ b/src/timepicker/timepicker.js @@ -386,11 +386,22 @@ angular.module('ui.bootstrap.timepicker') .value('$timepickerSuppressWarning', false) +.controller('TimepickerController', ['$scope', '$attrs', '$controller', '$log', '$timepickerSuppressWarning', function($scope, $attrs, $controller, $log, $timepickerSuppressWarning) { + if (!$timepickerSuppressWarning) { + $log.warn('TimepickerController is now deprecated. Use UibTimepickerController instead.'); + } + + angular.extend(this, $controller('UibTimepickerController', { + $scope: $scope, + $attrs: $attrs + })); +}]) + .directive('timepicker', ['$log', '$timepickerSuppressWarning', function($log, $timepickerSuppressWarning) { return { restrict: 'EA', require: ['timepicker', '?^ngModel'], - controller: 'UibTimepickerController', + controller: 'TimepickerController', controllerAs: 'timepicker', replace: true, scope: {},