i have array of jsons trying print out screen using loop. can results want without loop when try convert loop run issues. insight helpful. thank you.
this current code:
<div> <h2>document type</h2> <select> <option>document type : {{handoff[0].documenttype}}</option> <option>document type : {{handoff[1].documenttype}}</option> <option>document type : {{handoff[2].documenttype}}</option> <option>document type : {{handoff[3].documenttype}}</option> <option>document type : {{handoff[4].documenttype}}</option> </select> <select> <option ng-repeat="temp in handoff">document type : {{temp[0].documenttype}}</option> </select> <select> <option ng-repeat="temp in handoff">document type : {{temp.documenttype}}</option> </select> </div>
my results first "select" correct second , third have no results.
"handoffs":{"0":{ "documenttype":"0","conlid":"1230","username":"cu0","handoff":"h=81878e9e772bca176d868ca633bfb47d38274b1b209fd80856e56b47" },"1":{"documenttype":"1","conlid":"c010","username":"a010","handoff":"error: temporary problem encountered. please try request again in few minutes."},"3":{"documenttype":"3","conlid":"c010","username":"c10","handoff":"handoff=81878e9e77fb56e56b47"}}
you should correct json structure & shouldn't have "0", "1" & "2" in object literals in response, have array problem solved.
updated json
{ "handoffs": [{ "documenttype": "0", "conlid": "1230", "username": "cu0", "handoff": "h=81878e9e772bca176d868ca633bfb47d38274b1b209fd80856e56b47" },{ "documenttype": "1", "conlid": "c010", "username": "a010", "handoff": "error: temporary problem encountered. please try request again in few minutes." },{ "documenttype": "3", "conlid": "c010", "username": "c10", "handoff": "handoff=81878e9e77fb56e56b47" }] } }
update
@o4ohel suggested option, if don't have control on data & don't wanted change it. should use option
<select> <option ng-repeat="(key, value) in handoff">document type : {{value.documenttype}}</option> </select>
Comments
Post a Comment