0

I have function in angularJS invoked when clicked, I am also calling another service function inside that function, which is going to change some values for later use in first function.

Problem statement: Function getData finishes first with retrning model, and after it finishes it all process then calll getDetails. I want to make this call in sequence.

   this.getData = function () {
    var a = '';
    var b = '';
    var c = '';


   //I want this call to be finished before above function
    MyServices.getDetails(id, type)
    .success(function(data, status, headers, config){

    if(status == '200'){
         // my code goes here to change some values 
    })

  }


    var model = [];
    retrun model
};
Abdul
  • 1,416
  • 9
  • 26
  • 57
  • @Quentin this is not duplicate, this deals with angular and calling a method from services – Abdul May 23 '17 at 16:55
  • It's still about wanting to wait for an asynchronous function to finish running before continuing with the calling function. Angular being involved has no bearing on the batter. – Quentin May 23 '17 at 18:09
  • @Quentin so please will you suggest me something short to solve my issue, I have gone through the questions linked above as duplicate, but I could not get my solution, possibly due to less knowledge of Angular – Abdul May 24 '17 at 06:26

0 Answers0