2017-07-07 39 views
2

這是我的AngularJS ng-click函數不起作用。我需要通過這個功能來獲得branch.id角度onclick傳遞值

<tr data-id="0" ng-model="row1" ng-repeat="branch in details | filter:branchsearch | limitTo:10" style="border-bottom:1px solid ;"> 
         <td style="display: none">{{branch.branch_id}}</td> 
         <td ng-click="getid(branch.branch_id)" class="tablerow">&nbsp;&nbsp;&nbsp;{{branch.name}}</td> 
         <td ng-click="getid(branch.branch_id)" class="tablerow">&nbsp;&nbsp;&nbsp;{{branch.code}}</td> 
         <td ng-click="getid(branch.branch_id)" class="tablerow">&nbsp;&nbsp;&nbsp;{{branch.t_name}}</td> 
         <td ng-click="getid(branch.branch_id)" class="tablerow">&nbsp;&nbsp;&nbsp;{{branch.city}}</td> 
        </tr> 

而且還有我的角度的功能,這是不工作:

<!-- begin snippet: js hide: false console: true babel: false -->
var adminmodule = angular.module("adminmodule",[]); 
 

 
    // Branch Controller 
 
    adminmodule.controller("branchcontroller",['$scope','$http','$filter', function ($scope, $http,$filter) { 
 

 
     branchinfo(); 
 
     function branchinfo(){ 
 
    // Sending request to branchinfo.php files 
 
      $scope.currentPage = 0; 
 
      $scope.pageSize = 10; 
 
      $http.post('http://localhost/sms1/adminAsset/script/branchinfo.php').success(function(data){ 
 
    // Stored the returned data into scope 
 
       $scope.details = data; 
 

 

 
      }); 
 
     } 
 
     
 
     
 
     $scope.getid=function (id) { 
 
      alert(id+'haris Done'); 
 
     } 
 

 
     $scope.numberOfPages=function(){ 
 
      return Math.ceil($scope.getData().length/$scope.pageSize); 
 
     } 
 

 

 
    }]);

+2

'NG-modal'? 'ng-model'錯字?或模態插件? – tymeJV

+0

發佈你的控制器代碼 – MaazKhan47

+0

@tymeJV你在說什麼??????? –

回答

0

首先爲什麼會出現沒有任何有效載荷POST請求'獲取'details數據?然後考慮你需要的只是調試,以確保你從服務中獲得正確的細節數據,爲什麼你在tr上使用ng-model? (這不是輸入字段)。這裏有一個簡單的普拉克這表明你需要什麼:

https://plnkr.co/edit/JLYJNhs4hIBp10WVaIYM?p=preview

+0

感謝親愛的,我需要你的幫助 –

+0

現在我想在javascript代碼中獲得這個branchId我怎麼才能得到它 –