3

I have a controller that accesses a resource Tag like so:

$scope.tags = Tag.query();

which resolves to something like this:

$scope.tags = [
  { name: "tag1", label: "Tag1" },
  { name: "tag2", label: "Tag2" },
  { name: "tag3", label: "Tag3" },
  { name: "tag4", label: "Tag4" },
];

For this particular controller, the returned tags should have an additional attribute "active": true, like { name: "tag1", label: "Tag1", active: true }.

How can I iterate over the returned promise once it is resolved to add this boolean?

4

2 に答える 2