0

I have a API response DATA which is like below, there I'm trying to extract CONTACTS which I needed.

$scope.data = Object { ACCOUNT: "{"ACNO":"AC052","NAME":"madavi",…}", 
                       CONTACTS: Array[1], RETURN: "TRUE" }

After Extracting the CONTACTS from the json and i get

Array [ "{"CONTACTNAME":"Mr. sdhar","CONTA…"}", 
        "{"CONTACTNAME":"Ms. uma","CONTACTPH…"}" ]

I'm trying like this

  $scope.contactdetails = data.CONTACTS; 

  <div ng-repeat="contacts in contactdetails">              
      <a> {{ contact.CONTACTNAME  }} </a>
      <a> {{ contact.CONTACTEMAIL  }} </a>
      <a> {{ contact.CONTACTPHONE  }} </a> 
      <br>
  </div>

How can I get values in ng-repeat?

0

1 Answer 1

1

Each element in your array seems to be in string form, so after assigning it run JSON.parse on it:

$scope.contactdetails   = data.CONTACTS; 

for(var x = 0; x < $scope.contactdetails.length; x++){
    $scope.contactdetails[x] = JSON.parse($scope.contactdetails[x]);
}
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.