angular ng-repeat 的值错误?

Wrong value with angular ng-repeat?

我循环遍历对象数组内部的数组:

<div ng-repeat="benefit in oe.oeBenefits">
    <div class="oeInfo" style="clear: both;">
        <div class="col-md-2 oeCol">
            <img style="height: 160px; padding-top: 20px;" src="ppt/assets/beneTiles/HealthCare.svg">
        </div>
        <div class="col-md-5 oeCol">
            <h1>{{ benefit.benefitName }}</h1>
            <p>Maximum Election Amount: {{ benefit.benefitMax }}</p>
            <p>Contributions to be made: {{ benefit.numberOfContributions }}</p>
            <p ng-show="benefit.employerSeed != null">{{ benefit.employerSeed }}</p>
            <p>link</p>
        </div>              
        <div class="col-md-3 oeCol">
            <p class="oeFeatures" style="font-weight: 800;">Available Features</p>
            <ul>
                <li ng-repeat="Features.value in oe.oeBenefits.Features">{{ Features.value }}</li>
            </ul>            
        </div>  
        <p></p>
        <div class="col-md-12">
            <hr class="naviaHR100">                    
        </div>
    </div>
</div>

我的 JSON 代码 return 如下,但尽管发生了变化,但并没有获得该值。这是 JSON returned:

"oeBenefits": [
{
  "planId": "l0t3AlfKV%2fETUaQd0zZJGA%3d%3d",
  "benefitTypeId": 1,
  "benefitName": "Health Care FSA",
  "isHsaAvailable": false,
  "benefitMin": 0,
  "benefitMax": 3510,
  "numberOfContributions": 12,
  "carryoverAmount": null,
  "isDebitCard": true,
  "is100percent": true,
  "isGracePeriod": true,
  "allowDirectDeposit": true,
  "claimsRunout": 90,
  "employerSeed": "Your employer will contribute additional funds to your benefit",
  "learnMoreUrl": "http://www.naviabenefits.com/participants/benefits/health-care-fsa/",
  "Features": [
    {
      "key": "0",
      "value": "Navia Benefits Card"
    },
    {
      "key": "2",
      "value": "FlexConnect"
    },
    {
      "key": "4",
      "value": "Online claim submission"
    },
    {
      "key": "5",
      "value": "Online card swipe substantiation"
    }
  ]
},

来自对象的所有其他重复数据(s0 return 很好,只是这个功能部分我只需要值,而不是键。

你应该做 <li ng-repeat="Features in oe.oeBenefits.Features">{{ Features.value }}</li> 而不是 <li ng-repeat="Features.value

这应该可以解决您的问题

<div ng-repeat="benefit in oe.oeBenefits">
 <div class="oeInfo" style="clear: both;">
    <div class="col-md-2 oeCol">
        <img style="height: 160px; padding-top: 20px;" src="ppt/assets/beneTiles/HealthCare.svg">
    </div>
    <div class="col-md-5 oeCol">
        <h1>{{ benefit.benefitName }}</h1>
        <p>Maximum Election Amount: {{ benefit.benefitMax }}</p>
        <p>Contributions to be made: {{ benefit.numberOfContributions }}</p>
        <p ng-show="benefit.employerSeed != null">{{ benefit.employerSeed }}</p>
        <p>link</p>
    </div>              
    <div class="col-md-3 oeCol">
        <p class="oeFeatures" style="font-weight: 800;">Available Features</p>
        <ul>
            <li ng-repeat="feature in benefit.Features">{{ feature.value }}</li>
        </ul>            
    </div>  
    <p></p>
    <div class="col-md-12">
        <hr class="naviaHR100">                    
    </div>
</div>

问题在于您的内部循环没有使用正确的数组对象

你有一个嵌套的 ng-repeat,所以在你的情况下你的 ng-repeat 应该是这样的

<li ng-repeat="feature in benefit.Features">{{ feature.value }}</li>