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

Commit aede646

Browse files
committed
fix(rating): re-expose RatingController
- Re-expose `RatingController` with deprecation notice Closes #4529
1 parent 5604e59 commit aede646

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/rating/rating.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,17 @@ angular.module('ui.bootstrap.rating')
104104

105105
.value('$ratingSuppressWarning', false)
106106

107+
.controller('RatingController', ['$scope', '$attrs', '$controller', '$log', '$ratingSuppressWarning', function($scope, $attrs, $controller, $log, $ratingSuppressWarning) {
108+
if (!$ratingSuppressWarning) {
109+
$log.warn('RatingController is now deprecated. Use UibRatingController instead.');
110+
}
111+
112+
angular.extend(this, $controller('UibRatingController', {
113+
$scope: $scope,
114+
$attrs: $attrs
115+
}));
116+
}])
117+
107118
.directive('rating', ['$log', '$ratingSuppressWarning', function($log, $ratingSuppressWarning) {
108119
return {
109120
require: ['rating', 'ngModel'],
@@ -112,7 +123,7 @@ angular.module('ui.bootstrap.rating')
112123
onHover: '&',
113124
onLeave: '&'
114125
},
115-
controller: 'UibRatingController',
126+
controller: 'RatingController',
116127
templateUrl: 'template/rating/rating.html',
117128
replace: true,
118129
link: function(scope, element, attrs, ctrls) {

src/rating/test/rating.spec.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,8 @@ describe('rating deprecation', function() {
354354
var element = $compile('<rating ng-model="rate"></rating>')($rootScope);
355355
$rootScope.$digest();
356356

357-
expect($log.warn.calls.count()).toBe(1);
358-
expect($log.warn.calls.argsFor(0)).toEqual(['rating is now deprecated. Use uib-rating instead.']);
357+
expect($log.warn.calls.count()).toBe(2);
358+
expect($log.warn.calls.argsFor(0)).toEqual(['RatingController is now deprecated. Use UibRatingController instead.']);
359+
expect($log.warn.calls.argsFor(1)).toEqual(['rating is now deprecated. Use uib-rating instead.']);
359360
}));
360361
});

0 commit comments

Comments
 (0)