我循环浏览一些像这样的对象:
<div ng-repeat="choiceID in inputs[field.$id]">
<span ng-repeat="(key, choice) in submission.savedChoices | filter:{key:choiceID}">
{{key}}
{{choice}}
</span>
</div>
正如您所看到的那样,我尝试使用(key, value)
对中的密钥进行过滤,但它会引发语法错误,这样做的正确方法是什么?
答案 0 :(得分:0)
尝试使用ng-if:
<div ng-repeat="choiceID in inputs[field.$id]">
<span ng-repeat="(key, choice) in submission.savedChoices" ng-if="key==choiceID">
{{key}}
{{choice}}
</span>
</div>