title: how to get angularjs routeParams data into input from two different Database tables?
body: <p>my database has two tables one for "Customers" and another for "Tripsheets".
  I would like to call the routeParams data of Customers into Tripsheets.
  I tried something like this, but it does'nt work</p>
  
  <p>HTML</p>
  
  <pre><code> &lt;div class="row mini-stat" ng-controller="TripsheetCtrl1" &gt;
  &lt;div class="col-md-4"&gt;
      &lt;div class="input-group m-bot15"&gt;
        &lt;span class="input-group-addon btn-white"&gt;&lt;i class="fa fa-user"&gt;&lt;/i&gt;&lt;/span&gt;
        &lt;input ng-model="tripsheet.tripsheet_num" type="text" class="form-control input-lg"   &gt; 
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>JS</p>
  
  <pre><code>var urltd = 'http://localhost/tripsheets'; 
  
    app.factory('tripsheetFactoryd', function ($http) { 
     return { 
     getTripsheetsd: function () { 
     return $http.get(urltd + '/all'); 
      }, 
    addTripsheetd: function (tripsheet) { 
     return $http.post(urltd, tripsheet ); 
      }, 
    deleteTripsheetd: function (tripsheet) { 
     return $http.delete(urltd + '?id=' + tripsheet.id); 
      }, 
    updateTripsheetd: function (tripsheet) { 
     return $http.put(urltd + '?id=' + tripsheet.id, tripsheet); 
      } 
    }; 
   }); 
  
  
  
  var url = 'http://localhost/customers'; 
  
   app.factory('customerFactory', function ($http) { 
    return { 
     getCustomers: function () { 
     return $http.get(url + '/all'); 
    }, 
    addCustomer: function (customer) { 
     return $http.post(url, customer); 
    }, 
    deleteCustomer: function (customer) { 
     return $http.delete(url + '?id=' + customer.id); 
    }, 
   updateCustomer: function (customer) { 
     return $http.put(url + '?id=' + customer.id, customer); 
    } 
  }; 
  
  
   }); 
  
  
     app.controller('TripsheetCtrl1', function ($scope, tripsheetFactoryd, customerFactory, $routeParams) { 
        $scope.tripsheets = []; 
  
  
   tripsheetFactoryd.getTripsheetsd().then(function(data){
      $scope.tripsheets = data.data;
  
      $scope.tripsheet = {
       tripsheet_num: "{{customers[whichItem].name}}"
      };
  
  
  
    $http.get(url + '/all').success(function(data) {
       $scope.customers = data;
       $scope.whichItem = $routeParams.itemId;
  
     if ($routeParams.itemId &gt; 0) {
       $scope.prevItem = Number($routeParams.itemId)-1;
       } else {
          $scope.prevItem = $scope.customers.length-1;
       }
  
     if ($routeParams.itemId &lt; $scope.customers.length-1) {
       $scope.nextItem = Number($routeParams.itemId)+1;
       } else {
          $scope.nextItem = 0;
       }
     });
  
  
    });
  </code></pre>
  
  <p>}); </p>