javascript - changing ranking number to starts -
i need change ranking number star used following code: http://jsfiddle.net/ahakq/13/
but when ranking 0 - see no stars @ in example when
$scope.ratings = [{ current: 0, max: 10 }, { current: 3, max: 5 }]; how can change it?
this trying change
var updatestars = function () { scope.stars = []; var isempty = 1; (var = 0; < scope.max; i++) { scope.stars.push({ filled: < scope.ratingvalue }); isempty = 0; } if(isempty == 1) { scope.stars.push({ rating: < scope.ratingvalue }); } };
in $watch having condition if(newval) didn't let 0 go through creating stars in first place. :)
here's how have been:
scope.$watch('ratingvalue', function (oldval, newval) { if (angular.isdefined(newval)) { updatestars(); } });
Comments
Post a Comment