angularjs - How to fix this expression -


i trying print multiple * based on rating value. in javascript console array(10).join('*') produces 10 stars. when using in angularjs view, expression not evaluated. missing something?

<div data-ng-controller="skillscontroller">  <ul>    <li data-ng-repeat="skill in skills">{{skill.name}} - {{array(skill.rating).join('*')}}</li>  </ul> </div> 

app.js

app.controller('skillscontroller', function($scope){     $scope.skills = [         { name: 'ruby', rating: 5 },         { name: 'java', rating: 10}     ]; }) 

array not part of $scope. can following in controller.

app.controller('skillscontroller', function($scope){     $scope.skills = [         { name: 'ruby', rating: 5 },         { name: 'java', rating: 10}     ];      $scope.array = array;  }); 

i transformation in filter or directive.

app.filter('stars', function() {   return function(input) {     return array(input).join('*');   }; }); 

and then

{{skill.rating | stars}} 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -