Hi Scott,
I would do something like this:
angular
.module('SomeModule', [])
.controller("Controller", controller);
controller.$inject=["$scope", "MyService"]
function controller($scope,MyService) {
var vm = this;
vm.stuff = [];
vm.stuff.push(
{
name: "First thing I'm collecting data on",
id: 1384,
data: []
});
vm.stuff.push(
{
name: "Second thing I'm collecting data on",
id: 34839,
data: []
});
vm.stuff.forEach(function (stuff) {
MyService.getData(stuff.id).then(
function(data)
{
stuff.data = data;
});
})
}
Actually I would create a named function for the anonymous function in the
forEach, but that's just a preference!
Regards
Sander
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.