标签:
由于是在开发的时候被逼出来的做法,所以代码很糟糕,没有很好的活用ng,所以后期有空了再慢慢改咯
<div class="right" id="score">
<img class="allimgstrat imgstrat0" src="img/start.png" ng-click="theScore(0)" alt=""/>
...
<img class="allimgstrat imgstrat4" src="img/start.png" ng-click="theScore(4)" alt=""/>
</div>
$scope.theScore=function(num){
$(".allimgstrat").attr("src","img/start.png");
$scope.comment.stars=0;
for(var nums=0;nums<=num;nums++){
var classname= ".imgstrat"+nums;
$(classname).attr("src","img/start-full.png");
$scope.comment.stars=nums+1;
}
}
标签:
原文地址:http://www.cnblogs.com/caopangzi/p/5098787.html