After successfully generating a list of items using ng-repeat
, I found myself facing another challenge. I am currently trying to access and update a specific element within the collection, but I'm struggling with finding the right approach. Can anyone provide guidance on how to achieve this?
Here is a fiddle example for reference: http://jsfiddle.net/VNLPY/ (minimal setup)
<body ng-app>
<div ng-init="friends = [{name:'John', age:25}, {name:'Mary', age:28}]">
I have {{friends.length}} friends. They are:
<ul>
<li ng-repeat="friend in friends">
[{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old.
</li>
</ul>
</div>
</body>
In addition, assuming the data is retrieved from a JSON file, I am curious about the process of accessing each value within the rows of the collection and how to update a specific row in the JSON object. Will the interface reflect these updates accordingly?
Thank you