Basic array looping in AngularJS

Basic array looping in AngularJS



Can someone explain to me why this doesn't loop?



If I pre napIncident it gives null.



My code


<tr ng-repeat="napIncident in vm.NapIncidents">
<pre>vm.NapIncidents </pre>
<td>
napIncident.Incident
</td>



Pre output


[

"NapIncident":
"Incident": "Zahlunsverbindungen ändern",
"IncidentID": "0002724285",
"NapID": "4214",
"NapStatus": "erfasst",
"Username": "silvat",
"NumberOfApprovers": "2",
"RecordDate": "12-12-2018",
"CheckerInformationList": [

"CheckerInformation":
"Checker": "silvat",
"Date": "21-09-2018",
"TimeOfDay": "12:12:36",
"CheckerInfo": "Something",
"CheckerInfoText": "Something else"


],
"Alterations": [

"Alteration":
"Field": "IBAN",
"OldValue": "DE12345",
"NewValue": "DE54321"


]


]






your key is NapIncident, but you are using Incident. Change this line napIncident.Incident to napIncident.NapIncident

– Aleksey Solovey
Sep 10 '18 at 9:14


NapIncident


Incident


napIncident.Incident


napIncident.NapIncident






Any progress ...?

– davidkonrad
Sep 19 '18 at 10:03




2 Answers
2



you have to access to your item . In your case is napIncident. Check your html part you will find ng repeat "NapIncident in vm.NapIncidents" .
To access to the details NapIncident.NapIncident.Incident



When using ng-repeat you map each item to a temporary variable, and when you have an array of named literals i.e array of NapIncident: ... you must refer to NapIncident as a property :


ng-repeat


NapIncident: ...


NapIncident


<tr ng-repeat="item in vm.NapIncidents">
<td>
item.NapIncident.Incident
</td>
<td>
item.NapIncident.IncidentID
</td>
</tr>



and so on.



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế