am facing problem in execution function in desired order.
$scope.function1 = function(){
   var promiseObj= $http.get('Some Url');
  /* other logic goes here */
}
$scope.function2 = function(){
   var promiseObj= $http.get('Some Url');
  /* other logic goes here */
}
$scope.function3 = function(){
   var promiseObj= $http.get('Some Url');
  /* other logic goes here */
}
Now, want to execute function in following order,
1) function1
2) function2
3) function3
And I want function2 and function3 to be executed only after function1 completes
its execution. 
I have tried the following approach,
$.when(
  $scope.function1()
).then(
   $scope.function2(),
   $scope.function3()
      )
Still, it didn't work . First function2 gets executed then function1
 
     
     
    