1

I face a problem now that I am not able to fetch key and value from nested JSON data.Please help me I am doing any wrong.

<ion-item class="item item-thumbnail-left item-text-wrap" type="item-text-wrap" nav-transition="android" ng-repeat="data in hrINPROCandidateList | filter:search">
    <p class="small-text blue-text ">{{data.cfname}}</p>
    <div class="row" ng-repeat="(key,value) in data.note_detail_fields track by $index">
      <div class="col field">{{key}}</div>
      <div class="col field-info">{{value}}</div>
    </div>
</ion-item>

JSON Data

{
"responseToken": 1,
"list": [
    {
        "candidate_id": "4",
        "note_detail_fields": "{\"link\":\"View Interview Details\",\"job_title\":\"Sopra Executive\",\"Candidate\":\"Mark Ashton\",\"Interview_Type\":\"First Interview\",\"\":\"\",\"Duration\":\"30 minutes\",\"Date\":\"Wednesday, 23<sup>rd<\\/sup> November 2016\",\"Time\":\"09:00 to 09:30\",\"Location\":\"london\"}",
        "cfname": "Idris",
        "clname": "Alba"
    },
    {
        "candidate_id": "506",
        "note_detail_fields": null,
        "cfname": null,
        "clname": null
    },
    {
        "candidate_id": "32",
        "note_detail_fields": "{\"link\":\"View Shared Job\",\"job_title\":\"Manager\",\"Location\":\"London, United Kingdom\",\"Package\":\"800 - 850 per day GBP\"}",
        "cfname": "Sajal",
        "clname": "Agarwal"
    }
],
"totalCount": "4",
"success": 1,
"status": null
}

View data in app

View data in app

0

1 Answer 1

2

You re trying to loop through a string instead of an array, create a filter that parse the json contained in data.note_detail_fields

<div class="row" ng-repeat="(key,value) in data.note_detail_fields | fromJson track by $index">
  <div class="col field">{{key}}</div>
  <div class="col field-info">{{value}}</div>
</div>


app.filter('fromJson',function(){
    return function(input){ return angular.fromJson(input); }
})
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.