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

Commit ce1114a

Browse files
Foxandxsswesleycho
authored andcommitted
fix(rating): make deprecated controller work with 1.3.x
Closes #4582
1 parent 1c5e479 commit ce1114a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/rating/rating.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ angular.module('ui.bootstrap.rating', [])
2323

2424
this.stateOn = angular.isDefined($attrs.stateOn) ? $scope.$parent.$eval($attrs.stateOn) : ratingConfig.stateOn;
2525
this.stateOff = angular.isDefined($attrs.stateOff) ? $scope.$parent.$eval($attrs.stateOff) : ratingConfig.stateOff;
26-
var tmpTitles = angular.isDefined($attrs.titles) ? $scope.$parent.$eval($attrs.titles) : ratingConfig.titles ;
26+
var tmpTitles = angular.isDefined($attrs.titles) ? $scope.$parent.$eval($attrs.titles) : ratingConfig.titles ;
2727
this.titles = angular.isArray(tmpTitles) && tmpTitles.length > 0 ?
2828
tmpTitles : ratingConfig.titles;
29-
29+
3030
var ratingStates = angular.isDefined($attrs.ratingStates) ?
3131
$scope.$parent.$eval($attrs.ratingStates) :
3232
new Array(angular.isDefined($attrs.max) ? $scope.$parent.$eval($attrs.max) : ratingConfig.max);
@@ -39,15 +39,15 @@ angular.module('ui.bootstrap.rating', [])
3939
}
4040
return states;
4141
};
42-
42+
4343
this.getTitle = function(index) {
4444
if (index >= this.titles.length) {
4545
return index + 1;
4646
} else {
4747
return this.titles[index];
4848
}
4949
};
50-
50+
5151
$scope.rate = function(value) {
5252
if (!$scope.readonly && value >= 0 && value <= $scope.range.length) {
5353
ngModelCtrl.$setViewValue(ngModelCtrl.$viewValue === value ? 0 : value);
@@ -109,10 +109,10 @@ angular.module('ui.bootstrap.rating')
109109
$log.warn('RatingController is now deprecated. Use UibRatingController instead.');
110110
}
111111

112-
return $controller('UibRatingController', {
112+
angular.extend(this, $controller('UibRatingController', {
113113
$scope: $scope,
114114
$attrs: $attrs
115-
});
115+
}));
116116
}])
117117

118118
.directive('rating', ['$log', '$ratingSuppressWarning', function($log, $ratingSuppressWarning) {

0 commit comments

Comments
 (0)