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();     } }); 

working fiddle


Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -