Javascript 如何在angular js中使用web api获得可靠的下拉列表?

Javascript 如何在angular js中使用web api获得可靠的下拉列表?,javascript,angularjs,json,Javascript,Angularjs,Json,这是我的html代码 <body ng-controller="myController"> <select ng-change="getData(currentSelected)" class="form-control" id="selection" ng-model="currentSelected" ng-options="selection as selection for selection in data"> <option value

这是我的html代码

<body ng-controller="myController">
<select ng-change="getData(currentSelected)" class="form-control" id="selection" ng-model="currentSelected" ng-options="selection as selection for selection in data">
        <option value="" selected>Select the bankname</option>
       </select>
<select ng-change="getData(currentSelectedstate)"  class="form-control" id="selection" ng-model="currentSelectedstate" ng-options="my.state as my.state for my in newdata">
            <option value="" selected>Select the state</option>
        </select>
<select ng-change="getData1(currentSelecteddistrict)"  class="form-control" id="selection" ng-model="currentSelecteddistrict" ng-options="my.district as my.district for my in data1">
  <option value="" selected>Select the district</option>
        </select>
 </body>

前两个api工作正常,当我在第二个下拉菜单中选择特定状态时,它不取值,如何将获取的bankname和state附加到第三个api?这样我就可以在第三个下拉列表中获得地区列表,有人能帮忙吗?

$scope.getData使用了相同的作用域变量名这背后有什么原因吗?此API调用中可能有错误:
$http.get(“company.in/ifsc/district/”+name+,+name1)
只需控制台您对第三个请求的响应,并检查是否正确获取您正在使用的名称和名称1,但您没有在函数中传递名称变量,因此这将导致错误,并在控制台中检查您的结果。我尝试了它不起作用@Mistalis
 var app=angular.module("mainApp",[]);
   app.controller("myController", ["$scope", "$http",function ($scope,$http){
     $http.get("company.in/ifsc/banklist").then(function(response){
        $scope.data=response.data[0].data;
     });

       $scope.getData = function(name){

         $http.get("company.in/ifsc/state/" +name).then(function(response) {
          $scope.newdata = response.data;

        });
       }

     $scope.getData1= function(name1){

         $http.get("company.in/ifsc/district/""+name+", +name1).then(function(response) {
          $scope.data1 = response.newdata;
     });
       }
    }]);