My AngularJs app reads a json file having key/value pairs. The key/value pairs are generated by a java program using HashMap.
I am trying to generate HTML using ng-repeat directive in AngularJs in the following manner.
<li ng-repeat="(line, lineContents) in errorsFromLogFile">
{{line}} - {{lineContents}}
</li>
I also want to access the previous (key / value) pair.
Gone through these stackoverflow links How to obtain previous item in ng-repeat, Compare values inside ng-repeat and tried to access the previous key as
{{ errorsFromLogFile[$index-1].line }}
but it gives nothing. How to access previous key/value in this case?
The json file looks like this
- errorsFromLogFile: {
7308: "/tmp/cct7oRJm.s:2099392: Warning: .stabs: description field '11668' too big, try a different debug format",
7309: "/tmp/cct7oRJm.s:2099393: Warning: .stabs: description field '120d3' too big, try a different debug format",
7310: "/tmp/cct7oRJm.s:2099394: Warning: .stabs: description field '128a6' too big, try a different debug format",
7311: "/tmp/cct7oRJm.s:2099395: Warning: .stabs: description field '13046' too big, try a different debug format",
7312: "/tmp/cct7oRJm.s:2099396: Warning: .stabs: description field '1386c' too big, try a different debug format",
}