Search code examples
angularjstypescriptangular-promiseqangularjs-q

Difference between Sequential and Parallel executing in $q


In both of at the time of execution of an asynchronic operation only.


  • But how the $q handle for this is a Sequential call or Parallel call on runtime?
  • and let me brief explanation about the Difference between Sequential and Parallel executing in angular $q

Solution

  • Parallel Execution is something in which it doesn't wait for the previous process to be done,and Sequential is something in which process are executed one after another.

    $q service is used for asynchronous call (parallel execution | promise handling),by default it does parallel execution,it does not have support for sequential execution. If you want a sequential execution you have to handle it manually, wheich means after getting response from one call you make another call.

    var promise;
    promise.then(fun(){
       var promise;
       promise.then(fun(){
       })
    })