2014-09-30 53 views
0

我有一個帶有兩個不同名稱的ng模型的表單。我需要通過這兩種形式。這將如何工作?我需要通過currentItem + currentItem.Customer我遇到了PdfSharp控制器的問題,我想查看這是否是客戶值被傳回爲空的原因。如何將ng模型傳遞給表單

控制器

$scope.EmailPdf = function() { 

    var id = $scope.currentItem.JobId 
    $http.get('/api/Pdf/' + id).success(function() { 
     $scope.PrintPreviewModal(); 
    }); 
} 

形式

<form ng-submit="submitJob()" enctype="multipart/form-data" name="myForm"> 
    <fieldset> 
    <div class="col-xs-12"> 
    <label>Number:</label> 
    <input ng-model="currentItem.JobNumber" type="text" name="JobNumber"> 
    <label>Customer:</label> 
    <input type="text" ng-model="currentItem.Customer.CustomerName" 
     typeahead="customer.CustomerName for customer in customerArray | filter:$viewValue" 
     typeahead-on-select="selectEditCustomer($item)"> 
     </div> 
     <input ng-model="currentItem.CustomerId" type="text" ng-hide="true"/> 
     <div class="inline-fields"> 
     <label >Status:</label> 
     <selectng-model="currentItem.JobStatus"> 
     <option value="" selected="selected">Select</option> 
     <option value="Active">Active</option> 
     <option value="InActive">InActive</option> 
     <option value="Complete">Complete</option> 
     </select> 
     <label>Address:</label> 
     <input ng-model="currentItem.Customer.CustomerAddress" type="text"> 
     </div> 
     <div class="inline-fields"> 
     <label>Name:</label> 
     <input ng-model="currentItem.JobName" type="text"> 
     <label>City:</label> 
     <input ng-model="currentItem.Customer.CustomerCity" type="text"> 
     <label>St:</label> 
     <inputng-model="currentItem.Customer.CustomerState" type="text"> 

      <label>Zip:</label> 
     <input ng-model="currentItem.Customer.CustomerZipcode" type="text"> 
     </div> 
      <div class="inline-fields"> 
      <label>Address:</label> 
      <input ng-model="currentItem.JobAddress" type="text"> 
      <label>Ph:</label> 
      <input ng-model="currentItem.Customer.CustomerPhoneNumber" type="text"> 

      <label>Fax:</label> 
      <input disabled style="width: 105px"ng-model="currentItem.Customer.CustomerFaxNumber" type="text"> 
      </div> 


     <input ng-click="EmailPdf(currentItem)" type="button" value="Email" /> 

回答

0

那麼這是一個有點困難,告訴你問這裏到底是什麼,但它聽起來像是你的意思是,你需要比ID傳遞更多信息進入你的得到。所以,你可以通過整個CURRENTITEM一切是這樣的

  $http.get('/api/Pdf/' + id,angular.toJson($scope.currentItem))..... 

內容是你正在做什麼?