Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/408.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 按数组筛选角度JS ng选项_Javascript_Angularjs - Fatal编程技术网

Javascript 按数组筛选角度JS ng选项

Javascript 按数组筛选角度JS ng选项,javascript,angularjs,Javascript,Angularjs,我想用数组过滤ng选项。举例来说: <select ng-model="currentItem.Community.white_label_id" ng-options="whitelabel.WhiteLabel.id as whitelabel.WhiteLabel.name for whitelabel in whitelabels | filter:whitelabel.WhiteLabel.id in currentWhiteLabel.affiliatedids

我想用数组过滤ng选项。举例来说:

<select
    ng-model="currentItem.Community.white_label_id"
    ng-options="whitelabel.WhiteLabel.id as whitelabel.WhiteLabel.name for whitelabel in whitelabels | filter:whitelabel.WhiteLabel.id in currentWhiteLabel.affiliatedids"
>

currentWhiteLabel.AffiliatedId看起来像[73,71]


我该怎么做呢?

好的,我找到了一个解决方案,但是在选项中使用了ng repeat。希望这能帮助某人:

option value="whitelabel.WhiteLabel.id" ng-repeat="whitelabel in whitelabels" ng-if="currentWhiteLabel.affiliatedids.indexOf(whitelabel.WhiteLabel.id) != -1">{{whitelabel.WhiteLabel.name}}</option>
option value=“whitelabel.whitelabel.id”ng repeat=“whitelabel中的whitelabel”ng if=“currentWhiteLabel.affiliatedids.indexOf(whitelabel.whitelabel.id)!=-1”>{{whitelabel.whitelabel.name}

您可以共享一些示例数据吗?白标签是一个数组,如{“WhiteLabel”:{“id”:28,“名称”:“abd”,“代码”:“abc”,“类型”:“集合”,“活动”:真,“嵌入”:假,“子域”:“网站”:“}}。Ng选项很好,但我不能用数组过滤它们