2017-04-06 69 views
0

我有下面的選擇框我想通過選擇框的ID的功能角度JS

<select class="form-control" ng-model="community_type_id"> 
<option ng-repeat="x in myData" value="{{ x.community_type_id }}" ng-click="sendID(x.community_type_details)">{{ x.community_type_details }}</option> 
</select> 

我想x.community_type_id傳遞給函數sendID這樣。但不適合我的情況。

var app = angular.module('EntityApp', []); 
app.controller('EntityAppCntroller', function($scope, $http) { 
    $http.get("http://122.322.5.459:8080/apartment/community/type/list").then(function(response) { 
     $scope.myData = response.data.type; 
    }); 
    $scope.sendID = function(id) { 
     alert(id); 
     $http.get("http://11.22.33.44:8080/apartment/community/sub/type/list/" + id).then(function(response) { 
      $scope.myDatas = response.data.type; 
     }); 
    } 
}); 
+0

你應該在'