限制 ngrepeat 中的项目数量,然后使用 angularjs 将所有其他项目加起来
Limiting number of items in ngrepeat and then adding up all others in to one using angularjs
我在 AngularJS 中列出了该文件夹作为字母头像共享的用户数量,而且我知道如何将其限制为特定数量。但是你能帮我如何通过累加来显示剩余的条目吗?例如+1
、+2
等
我附上了在 HTML 文件中显示头像的示例图像和代码。
标签来自 HTML 页!
<td class="project-people" ng-repeat="emp in employee">
<img alt="image" class="img-circle" src="img/a2.jpg"
tooltip-placement="top" uib-tooltip="1{{emp.employee_Name}} is the owner">
<ng-letter-avatar shape="round" avatarcustombgcolor dynamic="true"
ng-repeat="usr in emp.employee_Shared |limitTo:2" data="{{usr.employee_Name}}">
</ng-letter-avatar>
</td>
您可以使用User_Shared.length - yourLimit
在这种情况下,您的限制是 2
,但您可以将其存储在更易于维护的变量中
<td class="project-people" ng-repeat="cli in client">
<img alt="image" class="img-circle" src="img/a2.jpg" tooltip-placement="top" uib-tooltip="1{{cli.Owner_Name}} is the owner">
<ng-letter-avatar shape="round" avatarcustombgcolor dynamic="true" ng-repeat="usr in cli.User_Shared |limitTo:2" data="{{usr.User_Name}}">
</ng-letter-avatar>
<ng-letter-avatar shape="round" avatarcustombgcolor dynamic="true" data="cli.User_Shared.length - 2"></ng-letter-avatar>
</td>
我在 AngularJS 中列出了该文件夹作为字母头像共享的用户数量,而且我知道如何将其限制为特定数量。但是你能帮我如何通过累加来显示剩余的条目吗?例如+1
、+2
等
我附上了在 HTML 文件中显示头像的示例图像和代码。
标签来自 HTML 页!
<td class="project-people" ng-repeat="emp in employee">
<img alt="image" class="img-circle" src="img/a2.jpg"
tooltip-placement="top" uib-tooltip="1{{emp.employee_Name}} is the owner">
<ng-letter-avatar shape="round" avatarcustombgcolor dynamic="true"
ng-repeat="usr in emp.employee_Shared |limitTo:2" data="{{usr.employee_Name}}">
</ng-letter-avatar>
</td>
您可以使用User_Shared.length - yourLimit
在这种情况下,您的限制是 2
,但您可以将其存储在更易于维护的变量中
<td class="project-people" ng-repeat="cli in client">
<img alt="image" class="img-circle" src="img/a2.jpg" tooltip-placement="top" uib-tooltip="1{{cli.Owner_Name}} is the owner">
<ng-letter-avatar shape="round" avatarcustombgcolor dynamic="true" ng-repeat="usr in cli.User_Shared |limitTo:2" data="{{usr.User_Name}}">
</ng-letter-avatar>
<ng-letter-avatar shape="round" avatarcustombgcolor dynamic="true" data="cli.User_Shared.length - 2"></ng-letter-avatar>
</td>