如何使用angularjs打印星形图案(我可以使用ng-repeat)

时间:2016-11-28 11:12:18

标签: javascript jquery angularjs

<span name="hover-star" data-toggle="tooltip" data-placement="bottom" class="red-tooltip" data-html="true" title="<div class='row' style='font-size:10px; color:blue; '><span class='glyphicon glyphicon-star col-sm-1' style='width:3%'></span>
<span class='glyphicon glyphicon-star col-sm-1' style='width:3%'></span>
<span class='glyphicon glyphicon-star col-sm-1' style='width:3%'></span>
<span class='glyphicon glyphicon-star col-sm-1' style='width:3%'></span>
<span class='glyphicon glyphicon-star col-sm-1' style='width:3%'></span>

我在HTML中使用的上述代码在工具提示中将模式打印为* * * * *

我在.js文件中使用了jquery callbyname  $( '跨度[名称= “悬停星级”]')工具提示();用于工具提示功能

现在,我想在我的工具提示中使用angularjs ng-repeat指令包含模式* ** *** **** *****(我已经在文档中读取了它的循环)。< / p>

谢谢

1 个答案:

答案 0 :(得分:0)

使用嵌套的ng-repeat

尝试以下操作
<div ng-repeat="i in getNumberPattern(numberPattern) track by $index" style="display:inline;">
  <span ng-repeat="i in getNumberPattern($index) track by $index">*</span>
</div>

查看 Plunker link

在答案中,我只显示了字符*,添加自己的样式以显示图标。