I have setup the following directive:
app.directive('starRating', function () {
return {
restrict: 'EA',
scope: {
rating: '=rating'
},
template:
'<ul class=\'list-unstyled\'>' +
'<li><span class=\'glypicon glyphicon-star\'></span></li>' +
'</ul>'
};
});
I then have the following HTML:
<star-rating rating="rating"></star-rating>
rating
is an array as such: [1,3,2,4,5]
and this implies that the first rating is 1 star, 2nd rating is 3 stars, ect.
The goal of the directive is to repeat the amount of .glyphicon-star
icons of the rating.