I have the following setup
HTML:
<span star score="{{resto.rating}}"></span>
A controller that downloads data and sets it in resto and the directive below. My problem is that the link function is being called before the score expression has been interpolated, so I only ever get 1 star.
angular.module 'afmnewApp'
.directive 'star', () ->
return {
scope:
score: '@'
template : """
<ul class="rating">
<li ng-repeat="star in stars" ng-class="star">
*
</li>
</ul>
""",
link : (scope, elem, attrs) ->
scope.stars = []
for x in [1..scope.score] # should it be attrs?
scope.stars.push({'fill'})
}