I have a scenario where i need to change the star colors based on hover value for appending the color i am using custom directive and for displaying stars i am using ui-rating(ui-bootstrap)
html:
<uib-rating ng-model="rate" class="col-xs-3 star-color" max="max" read-only="isReadonly" on-hover="rating=value;hoveringOver(value)" star-color rating="rating" ng-click="viewPage||fnPutRating(rating)" on-leave="overStar = null" titles="['one','two','three']" aria-labelledby="default-rating"></uib-rating>
here star-color
is the custom directive
directive:
angular.module('hrPortalApp')
.directive('starColor', function() {
return {
restrict: 'A',
scope: {
rating: "="
},
link: function(scope, elem, attr) {
console.log($scope.rating);
switch (todoText) {
case "1":
elem.style.color='red'
break;
case "2":
elem.style.color='red'
break;
case "3":
elem.style.color='green'
break;
case "4":
elem.style.color='green'
break;
case "5":
elem.style.color='green'
break;
}
}
};
});
but here i am getting an error as
angular.js:13642 Error: [$compile:multidir] Multiple directives [starColor (module: hrPortalApp), uibRating (module: ui.bootstrap.rating)] asking for new/isolated scope on: <span ng-mouseleave="reset()" ng-keydown="onKeydown($event)" tabindex="0" role="slider" aria-valuemin="0" aria-valuemax="{{range.length}}" aria-valuenow="{{value}}" aria-valuetext="{{title}}" ng-model="rate" class="col-xs-3 star-color" max="max" read-only="isReadonly" on-hover="rating=value;hoveringOver(value)" star-color="" rating="rating" ng-click="viewPage||fnPutRating(rating)" on-leave="overStar = null" titles="['one','two','three']" aria-labelledby="default-rating">
I dont understand why i am getting this error Any help would be highly appreciated.