使用angularJS在下拉列表框中显示JSON数组的唯一值

时间:2016-01-17 14:34:09

标签: javascript mysql angularjs json

我的JSON数组名为employee:

[{"id":15,"userId":"Vikram.Swaminathan@gmail.com","fromDate":"2016-01-05","toDate":"2016-01-14","typeofLeave":"Sick Leave","region":"IND","status":"Accepted","daysapplied":8}
{"id":16,"userId":"Vikram.Swaminathan@gmail.com","fromDate":"2016-01-13","toDate":"2016-01-13","typeofLeave":"Paternity Leave","region":"IND","status":"Accepted","daysapplied":1}

在我的Html中:

<select>
<option> ng-repeat="email in employee"  {{email.userId}} </option>
</select>

我的下拉列表应该只显示一次基本上我申请了多少次离开它应该只在下拉列表中显示Vikram.Swaminathan@gmail.com

<select>
<option ng-repeat="email in employee | unique:'userId' ">{{email.userId}}</option>
</select>

我不知道如何在angularJS中使用unique如何包含?当我包含i时会收到错误Error: $injector:unpr Unknown Provider

0 个答案:

没有答案