2016-02-23 28 views
0

通過陣列上午循環對象的數組裏面:角度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代碼返回以下,但得到的是價值恰恰是沒有,儘管變化發生。這裏是JSON返回:從對象

"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回就好了,只是這個功能,我想只是值,而不是關鍵部分

+1

是您的內環你的問題解決了?只需替換ng-repeat中的Features.value即可。在下面檢查我的答案。 –

回答

1

這應該解決您的問題,爲你

<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> 

的問題是你沒有使用正確的數組對象

1

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

1

你有一個嵌套的NG-重複,所以你的情況你的NG-重複應該看看這個

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