1
我想创建select,它显示过滤器中元素的数量。好像是Angularjs select with filteredred elements
Here是PlunkR的代码,我已经写了。这是伟大的使他的工作,但我不能在选择添加计数active/deactive
元素。我怎样才能做到这一点? 感谢的
我想创建select,它显示过滤器中元素的数量。好像是Angularjs select with filteredred elements
Here是PlunkR的代码,我已经写了。这是伟大的使他的工作,但我不能在选择添加计数active/deactive
元素。我怎样才能做到这一点? 感谢的
您可以在与选择选项进行绑定之前格式化值。
<select ng-options="i as format(i) for i in statusList" ng-model="statusFilter">
</select>
格式的功能是,
$scope.format = function(val) {
return val.status + ' ' + $scope.objs.filter(function(state) {
return state.status === val.value;
}).length;
}
凡$scope.objs
是具有active/inactive
项值的阵列。
Here是工作plunkr
感谢的很多,这个人是工作液太 –
感谢对编辑工作后@苏伦 - Srapyan –