I am a newbie with Angularjs, and trying to figure it up:
in boardService
there are 2 function
var getLiveCards = function () {
return $http.get(endpointService.getLiveCards(), {})
.then(function (response) {
return response.data;
}, function (error) {
return $q.reject(error.data.Message);
}
);
};
var getRelationshipTypes = function () {
return $http.get(endpointService.getRelationshipTypes(), {})
.then(function (response) {
return response.data;
}, function (error) {
return $q.reject(error.data.Message);
}
);
};
and
i am trying to call a controller, with the data received from both of the functions:
vm.relationsEdit = function (card) {
boardService.getLiveCards()
.then(function (data) {
vm.liveCards = data
boardService.getRelationshipTypes()
.then(function (types) {
vm.types = types;
cardRelationsModalService.relationsEdit(card, vm.liveCards, vm.types)
.then(function (response) {
console.log("Card edited: " + response);
});
})
}, onError);
}
When i put a break-point with chrome debugger, in that line: vm.liveCards = data
, data
contains data from getLiveCards
but nothing is happen after that.
What am I doing wrong? how can i get data from the 2 functions and send it to cardRelationsModalService.relationsEdit
function?