0
我在选择框的问题angularjsAngularJS选择框
我得到使用这个我locationList:
locationFactory.getLocation().then(function (data) {
$scope.locationList = data.data.locationList;
});
,结果是这样的:Result
这是怎么我将它添加到视图中的选择框中:
<select ng-options="location.strBarangay for location in locationList"
ng-model="details.location" id="crOrderLoc">
</select>
我的问题是,无论何时我选择op它总是有一个空白选项,它具有我的json中第一个对象的值。 实施例:我有一个JSON对象[{1},{2},{3}] 而在我的选择它将安排是这样的:
- 选项值= 1(它会显示空)
- 选项值= 2(它会显示1)
- 选项值= 3(它会显示2)
我尝试这样设置我的模型的值中选择
$scope.details.location = {
dblLocationPrice: $scope.locationList[0].dblLocationPrice,
intLocationID: $scope.locationList[0].intLocationID,
intLocationStatus: $scope.locationList[0].intLocationStatus,
strBarangay: $scope.locationList[0].strBarangay,
strCity: $scope.locationList[0].strCity
};
但有一个错误: angular.min.js:117类型错误:未定义 在新prodSalesCtrl
无法读取属性“0”,但它是在这里工作http://jsfiddle.net/MTfRD/3/(编辑)
但它不是在工作我选择
它的工作。非常感谢你。 对不起,我不能给你+代表。我在这里还是新手 – jjjjjj