I am new to angular js . I have a json response which i want to convert to list of objects and use ng-repeat to display these object. I am getting a list of these objects which are as follow
1 :
{"_id":"56e75b42c9cbbb7765414cdf",
"email":"[email protected]",
"phone":"02-653-2900",
"display_name":"KFC",
"registered_name":"KFC",
"__v":0,
"address":
{"country":"TH",
"state":"TH14,
"postcode":"10150",
"suburb":"Klongteay",
"address2":"Sukhumvit Rd",
"address1":"142 Two Pacific Place"},
"date_modified":"2016-03-15T00:45:54.631Z",
"date_created":"2016-03-15T00:45:54.626Z",
"status":"active",
"logo":{"path_to_file":"90cf845d95.png"}
}
I have saved the above object in $scope.results and i want to do something like
<div ng-repeat="user in results.data ">
<span>Phone </span><span>{{user.phone}}:</span>
<span>Display Name</span><span>{{user.display_name}}:</span>
</div>
How can i achieve this?
JSON.parse
. See stackoverflow.com/questions/4935632/parse-json-in-javascript and msdn.microsoft.com/library/cc836466(v=vs.94).aspx"address": {"country":"TH", "state":"TH14",
apart from that it should work as it is.get
,.then
or.success
?