如何从ng-repeat条目中排除?

时间:2018-07-23 16:39:24

标签: javascript angularjs

我有问题!我不明白如何创建条件-在模板中-如果数组具有键为“ HIS”且长度超过一个的项,则不需要打印项。换句话说,如果该阵列仅包含NIS(不含其他货币),则不应显示... 我认为它应该像对象的 hasOwnProperty 一样工作,对吧?

var currencies = {
 "NIS": {
    "income": 12,
    "received" : 13
  },
  "USD" : {
     "income": 122,
     "received" : 113,
     "nisCourse" : 3,4
   }
};

并认为它是ng-reapet

<div class="income_total_row"
     ng-repeat-start="(key, value) in currencies track by $index"
     ng-if="value.income != 0">
     {{ value.income }}
</div>

<div class="income_total_row" ng-if="key !== 'NIS' && value.income != 0"
     ng-repeat-end="">
         {{ value.nisCourse }}
</div>

我试图解释(

0 个答案:

没有答案