Как связать .then функции и функцию успешного обратного вызова в Angular.js

Я пытаюсь связать вложенные функции .then и вызывать функции успеха, но callback вызывает сам запуск.

//public method fn
function fn(callback) {
//calling the 1st API request
fn1()
  .then(function(response) {
    //2nd API request function
    call1(response);
  }, function(error) {
    return $q.reject({
    responseStatus: error.status
  });

  })
  // Returning response
  .then(function(response) {
    callback({
    responseStatus: 200
    });
  }, function(error) {
    callback({
      responseStatus: 500
    });
  });
}

function call1(response) {
  //2nd API
  fn2()
    .then(function(response) {
     //3rd API request function
        call2(response);
      }, function(error) {
        return $q.reject({
        responseStatus: error.status
      });
    });
}


function call2(response) {
  //3rd API request 
  fn3()
    .then(function(response) {
        return lastfunction();
      //here i need to callback the success  response status
      }, function(error) {
        return $q.reject({
        responseStatus: error.status
      });
    });
}


function fn1(){
 //some code 
 }
function fn2(){
//some code 
}
function fn3(){
//some code 
}

//Controller

//i will show response status callback here

if(response.status ==200){
  show output;
 }
 else{
  //response 500
  show errors;
  }

В основном мне нужно перезвонить "200" статус ответа на другой контроллер на все вызовы службы успешны, и даже если один запрос не удалось, мне нужно отправить "500". с моим кодом 'статус ответа' 200 'вызывает саму первую функцию .then. Я хочу называть эту услугу звонками в качестве очереди

Любая помощь будет оценена.

Ответы на вопрос(2)

Ваш ответ на вопрос