How to call function after service request success in Ionic

Hello. Maybe somebody can help, please. The following code returns response from an API, where the data must be loaded into a modal. Problem is the modal opens before the data is returned. Any suggestions?

function(success){ // success callback

//wait for this to finish populating the object before opening modal
$scope.objNode =;

//open modal code here
$scope fncModalResourceShow($scope.objNode.nid);

function(error){ // callback to handle request error
console.log('error', error)
$scope.fncModNotification('Error', JSON.stringify(;
function(notify){ // notify callback, can fire few times

1 person has
this question