带有单选的AngularJS列表框控件

时间:2019-03-08 10:40:30

标签: angularjs angularjs-ng-repeat angularjs-ng-options angularjs-select

我只是在寻找一个具有单一选择的列表框,以便可以从列表框中选择每个项目。

但是将其设置为multiple = false后,无法使用下面的代码将其变为单选。

有人可以在这里建议我的代码吗?

$http({
                method: 'GET',
                url: 'http://xxxx/api/controller/GetAllItems',
                params: { Pt_Id: 'US' }
            }).then(function successCallback(response) {
                //  alert(response.data);
                $scope.items = response.data;
            }, function errorCallback(response) {
                // alert(response);
            });

<select ng-model="itm" multiple="false" size="10" ng-options="itm.ITEM_ID for itm in items"></select>

1 个答案:

答案 0 :(得分:0)

删除选择中的multiple="false",然后可以进行单个选择

<select ng-model="itm" size="10" ng-options="itm.ITEM_ID for itm in items"></select>