ng-click 在点击网络时没有给出任何响应 api

ng-click is not giving any response while hitting web api

html 页面包含完整代码。

<body ng-app="mymodule">
    <label>Search:</label><input type="text" placeholder="Search Here" ng-model="search" />
    <table ng-controller="cntrlbtn" class="table table-bordered">
        <tr ng-repeat="resp in inp">
            <td></td>
        </tr>
    </table>
    <table ng-controller="mycontroller" class="table table-bordered">
        <tr ng-repeat="resp in res | filter :search" >
            <td colspan="1"><input type="button" class="btn btn-danger" value="{{resp.ct_nm}}" ng-click="click(resp.ct_nm);" /></td>       
        </tr>
    </table>
    <span ng-repeat="resp in res" ng-controller="mycontroller">
        <button ng-click="click(resp.ct_nm);">{{resp.ct_nm}}</button>
    </span>
    <table ng-controller="mycontroller" class="table table-bordered">
        <tr ng-repeat="resp in inp">
            <td colspan="1">{{resp.sbct_nm}}</td>
        </tr>
    </table>

并且 angular 脚本是 here.The main API 即 http://localhost/Publish/ProductCategory/GET' 是 working.But 第二个 API 即在 $scope.click 不是 working.Testing 外面的 API 是赋值。

在 google chrome 开发者工具中,它正在点击 API 但没有得到任何响应。

var appmodule = angular.module('mymodule', []).controller('mycontroller', function ($scope, $http,$location,$anchorScroll) {
  $http.get('http://localhost/Publish/ProductCategory/GET').then(function (response) {
    $scope.res = response.data;
  });

  $scope.click = function (btnval) {
    debugger;
    $http.get('http://localhost/Publish/ProductSubCategory/GET?pdnm=Laptop').success(function (btnres) {
      $scope.inp = btnres;
    });
  };
});

我刚试过你的代码,它工作正常。但是你需要删除所有额外的

ng-controller="mycontroller"

在您的 html 中,因为它们导致了 angular 错误,因此它看起来像这样:

<label>Search:</label><input type="text" placeholder="Search Here" ng-model="search" />
    <table class="table table-bordered">
        <tr ng-repeat="resp in inp">
            <td></td>
        </tr>
    </table>
    <table class="table table-bordered">
        <tr ng-repeat="resp in res | filter :search" >
            <td colspan="1"><input type="button" class="btn btn-danger" value="{{resp.ct_nm}}" ng-click="click(resp.ct_nm);" /></td>       
        </tr>
    </table>
    <span ng-repeat="resp in res" >
        <button ng-click="click(resp.ct_nm);">{{resp.ct_nm}}</button>
    </span>
    <table class="table table-bordered">
        <tr ng-repeat="resp in inp">
            <td colspan="1">{{resp.sbct_nm}}</td>
        </tr>
    </table>