<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <title>angularjs $http synchronous call</title>
  <script src="https://code.angularjs.org/1.3.14/angular.js"></script>
  <script>
    var app = angular.module("promisesApp", []);

    app.controller("promisesCtrl", function($scope, $q) {

        var promise1 = $q.defer();
        var promise2 = $q.defer();

        //This is promise1.
        promise1.promice.then(function(value) {
          // TODO : success code custom login here.
        }, function(value) {
          // TODO : error code custom login here.
        });

        //This is promise2.
        promise2.promice.then(function(value) {
          // TODO : success code custom login here.
        }, function(value) {
          // TODO : error code custom login here.
        });

        //Call both the promises here.
        $q.all([promise1.prpmice, promise2.promice])
          .then(function() {
            //TODOD:  When both task are completed here.
          }, function() {
            //TODOD:  When both task are rejected here. 
          });
      }
  </script>
</head>

<body ng-app="promisesApp">
  <div ng-controller="promisesCtrl">
    <h1>Hello, Anil Singh</h1>
  </div>
  
</body>

</html>
// Code goes here

/* Styles go here */