$scope.accounts = [
{id: 1, name: 'Tommy',status:'premium'},
{id: 2, name: 'Alexander',status:'free'},
{id: 3, name: 'Lorem',status:'banned'},
{id: 4, name: 'Ipsum',status:'premium'}
{id: 5, name: 'Dot sit',status:'Y'}
];
如何动态调整此json输出中的情况?
例如,groupby中的多个数据
<select>
<option>premium</option>
<option>free</option>
<option>banned</option>
<option>y</option>
</select>
(我的英语不好)
答案 0 :(得分:0)
<select ng-options="item as item.status for item in (accounts | unique: 'status')"></select>
您需要添加https://github.com/angular-ui/angular-ui-OLDREPO/tree/master/modules/filters/unique
中的过滤条件