我想获取所选项目的ID,但console.log
显示 undefined 。
查看
<select ng-change="test()" ng-model="selectedone" ng-options="item.id as item.pseudo for item in friends"></select>
控制器
$scope.test = function(){
console.log($scope.selectedone);
}
答案 0 :(得分:3)
以下是正在运行的代码:
视图:
<select ng-change="test(selectedId)" ng-model="selectedId" ng-options="id.id as id.pseudo for id in idList"> </select>
控制器:
$scope.test = function(selectedId) {
alert(selectedId);
}