I'm trying to use jquery raty plugin for star rating with angularjs. I created a custom directive for it as the following:
app.directive("ngStars", function() {
return {
restrict: 'A',
link: function(scope, elem, attrs) {
$(elem).raty({
'path': base_url+'images',
score: attrs.score,
readOnly: true,
hints: ['سىء جدا', 'سىء', 'عادى', 'جديد', 'ممتاز'],
});
}
}
});
and my html as the following
<div ng-repeat="place in places">
<div ng-stars class="star" score={{place.rate}}></div>
</div>
the plugin runs fine if i predefined the score
attribute value as score="5"
, But what i need is to set the score value through angularjs score="{{place.rate}}"
but this is not working.
How can i solve this problem?