i want create array containing objects firstly, first array server containing list of devices [ {accountid : "sysadmin",deviceid : "123"}, {accountid : "sysadmin",deviceid : "3"} ... ] then create second array containing objects each object represent device(deviceid) , contains array of events of device server i loop upon first array : $scope.myarrayofdevices = []; angular.foreach(response, function(device){ $scope.myobject={}; $scope.myobject.device = device.deviceid; $http.get('events') .success(function (data) { $scope.myobject.events = data; }); $scope.myarrayofdevices.push($scope.myobject); });//end loop i events data server correctly . but, when check $scope.myarrayofdevices array first object deviceid , no event array , second object deviceid , events array correctly like : [ {deviceid : 123, events:}, {deviceid : 3 , events : array...
Comments
Post a Comment