2016-12-02 51 views
1

我列出了文件夹在AngularJS中以字母头像的形式共享的用户数量,同时我也知道如何将它限制到某个数字。但是,你能帮助我如何通过合计来显示剩余的条目吗?例如,+1,+2限制ngrepeat中的项目数量,然后将所有其他项目合并为一个使用angularjs

我附加了一个示例图像和代码,以在HTML文件中显示头像。 Sample Img

来自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> 

回答

2

您可以使用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> 
+1

工作好一些modification.Anyways感谢为了答案! – Sharath

相关问题