shady87 shady87 - 4 months ago 6x
AngularJS Question

Add properties to array objects - AngularJS

How can I add properties to objects in an array by looping through the array?

Example I have an array with objects;

contains many addresses.

And lets say that each object has only have 4 properties;


Now I want to add more properties to each of the objects in the array.


Any help appreciated.


Use .map to loop the collection:

$scope.addresses = $ {
      address.location = "X";   
      return address;