title: How to add multiple ajax request in Angularjs single controller
body: <p>How can I have multiple ajax response data in a single controller in angular.js?</p>
  
  <p>Sample code (Controller):</p>
  
  <p>First API: (Getting dashlet details from server)</p>
  
  <pre><code>var Api = $resource('/portal/api/notificationdashlet/'+id);
      $scope.tableParams = new ngTableParams({
         page: 1,            // show first page
         count: 10,          // count per page
         sorting: {
           name: 'asc'     // initial sorting
         }
      }, {
      total: 0,           // length of data
      getData: function($defer, params) {
          // ajax request to api
          Api.get(params.url(), function(data) {
              $timeout(function() {
                  //params.total(data.total);
                  $defer.resolve(data.result);
                  console.log(data.result);
              }, 10);
          });
      }
  });
  </code></pre>
  
  <p>Second API: (Getting DOB details from server)</p>
  
  <pre><code>var Api1 = $resource('/portal/api/notificationdob/');
      $scope.tableParams = new ngTableParams({
         page: 1,            // show first page
         count: 10,          // count per page
         sorting: {
           name: 'asc'     // initial sorting
         }
      }, {
      total: 0,           // length of data
      getData: function($defer, params) {
          // ajax request to api
          Api1.get(params.url(), function(data) {
              $timeout(function() {
                  //params.total(data.total);
                  $defer.resolve(data.result);
                  console.log(data.result);
              }, 10);
          });
      }
  });
  </code></pre>
  
  <p>View (HTML):</p>
  
  <p>First API Table:</p>
  
  <pre><code>&lt;table ng-table="tableParams" show-filter="true" class="table"&gt;
      &lt;thead&gt;
          &lt;tr&gt;
          &lt;td&gt;Title&lt;td&gt;
          &lt;td&gt;Name&lt;td&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr ng-repeat="val in $data "&gt;
              &lt;td&gt;{{val.t}}&lt;/td&gt;
              &lt;td&gt;{{val.n}}&lt;/td&gt;
          &lt;/tr&gt;
      &lt;tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Second API Table:</p>
  
  <pre><code>&lt;table ng-table="tableParams" show-filter="true" class="table"&gt;
      &lt;thead&gt;
          &lt;tr&gt;
          &lt;td&gt;Date&lt;td&gt;
          &lt;td&gt;Desc&lt;td&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr ng-repeat="details in $data "&gt;
              &lt;td&gt;{{details.d}}&lt;/td&gt;
              &lt;td&gt;{{details.des}}&lt;/td&gt;
          &lt;/tr&gt;
      &lt;tbody&gt;
  &lt;/table&gt;
  </code></pre>