2017-07-07 66 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我怎么才能得到它 –