javascript - populate nested ng-repeat with complex JSON -
i trying populate td
multiple values in single row angularjs's ng-repeat within ng-repeat. have working until try access 3rd nested object.
object heicarchy:
object
-renewaluis
--patentui
---property.patentapplicationnumber (this want access)
originally began $.each
function loop through each object came across thread nested ng-repeat, , explains more efficient , easier loop through data. issue can access properties of renewaluis
, when when add object ng-repeat
syntax, no data displays.
this code works:
<tr ng-repeat="transaction in $ctrl.transactionhistory"> <td> <span ng-repeat="item in transaction.renewaluis">{{item.renewalduedate}}<br></span> </td> </tr>
this doesn't (but need to):
<tr ng-repeat="transaction in $ctrl.transactionhistory"> <td> <span ng-repeat="item in transaction.renewaluis.patentui">{{item.patentapplicationnumber}}<br></span> </td> </tr>
question
why isn't td
populating data patentui
object?
json
[ { "renewaluis":[ { "patentui":{ "patentapplicationnumber":"112233.4", "title":"a patent generated createdummypatentuiforsearchaddpatent()", "filingdate":1171411200000, "business":{ "businessnumber":"bo2", "businesspin":3586, "businessname":"bodget , scarper patent lawyers in", "phonenumber":"203141703", "timezone":"(utc-08:00) pacific time (us & canada)", "street":"thats real town name", "city":"cut , shooper", "zip":54321, "isbillingaddresssame":true, "billingstreet":"bstr", "billingcity":"bcty", "billingstate":"bstt", "billingzip":2222, "id":1, "version":48, "usstate":"texas" }, "primaryapplicantname":"james dean", "clientref":"electric bananas", "shorttitle":"jimaroo", "epopatentstatus":"empty", "lastreneweddateexepo":1485648000000, "renewalyear":7, "renewalstatus":"renewal in place", "patentpublicationnumber":"112233.4+1", "notifications":null, "id":1, "version":17, "currentrenewalcost":1.11, "costbandenddate":1501424837236, "renewalcostnextstage":1111111.11, "renewalduedate":1488240000000, "filingdateui":"wed feb 14, 2007", "notificationuis":null, "costbandenddateui":"sun jul 30, 2017", "renewalduedateui":"tue feb 28, 2017", "lastreneweddateexepoui":"sun jan 29, 2017" } }, { "patent":null, "activepaymentid":null, "fee":{ "renewal":null, "renewalfee_eur":123.45, "extensionfee_eur":234.56, "processingfee_usd":20.00, "expressfee_usd":230.00, "urgentfee_usd":0.00, "latepaypenalty_usd":0.00, "fxrate":0.88, "subtotal_usd":608.01, "id":2, "version":0 }, "certificate":{ "renewal":null, "certificatename":"harry", "issuedate":1499778000000, "docpath":"hardcodedpdffolder/certificates/", "filename":"dummycertificatenumber 1.pdf", "certificatetemplateid":"democert#01", "id":1, "version":0, "url":"hardcodedpdffolder/certificates/dummycertificatenumber 1.pdf" }, "renewalyear":14, "renewalduedate":1512086399000, "renewalperiod":"green", "renewalstatus":"renewal in place", "renewalattemptsmade":1, "id":2, "version":0, "renewalduedateui":"thu nov 30, 2017", "certificateurl":"hardcodedpdffolder/certificates/dummycertificatenumber 1.pdf", "patentui":{ "patentapplicationnumber":"332211", "title":"a patent inspired despicable me", "filingdate":1173657600000, "business":{ "businessnumber":"bo2", "businesspin":3586, "businessname":"bodget , scarper patent lawyers in", "phonenumber":"203141703", "timezone":"(utc-08:00) pacific time (us & canada)", "street":"thats real town name", "city":"cut , shooper", "zip":54321, "isbillingaddresssame":true, "billingstreet":"bstr", "billingcity":"bcty", "billingstate":"bstt", "billingzip":2222, "id":1, "version":48, "usstate":"texas" }, "primaryapplicantname":"paul newman", "clientref":"gru", "shorttitle":"steal moon !", "epopatentstatus":"empty", "lastreneweddateexepo":null, "renewalyear":-1, "renewalstatus":"renewal in place", "patentpublicationnumber":"112233.4+2", "notifications":null, "id":2, "version":0, "currentrenewalcost":1.11, "costbandenddate":1501424837240, "renewalcostnextstage":1111111.11, "renewalduedate":1490914800000, "filingdateui":"mon mar 12, 2007", "notificationuis":null, "costbandenddateui":"sun jul 30, 2017", "renewalduedateui":"fri mar 31, 2017", "lastreneweddateexepoui":"" } } ] } ]
is patentui property of each renewalui ?
if it's case ng-repeat won't work properly. can use directive ng-repeat iterate on collection objects (like arrays are).
the ngrepeat directive instantiates template once per item collection.
https://docs.angularjs.org/api/ng/directive/ngrepeat
so code work be
<tr ng-repeat="transaction in $ctrl.transactionhistory"> <td> <span ng-repeat="item in transaction.renewaluis">{{item.patentui.patentapplicationnumber}}<br></span> </td> </tr>
Comments
Post a Comment