我的任务很简单。我能够将值设置为来自restful api的文本框。我可以使用{{currentCommodity.commodityName}}获取并显示在原始HTML页面上但是,无法将值设置为select标记甚至虽然我能够获得价值。
我的代码是
$scope.editCommodity = function(commodityIndex) {
console.log("commodities object",$scope.commoditiesAdded[commodityIndex].commodityName);
$scope.currentCommodity.commodityName = $scope.commoditiesAdded[commodityIndex].commodityName;
}
它返回一个带有稻谷的商品名称..
---{{currentCommodity.commodityName}}-
<select class="form-control selection_size" ng-change="selectunits(currentCommodity.commodityName.commodityID)" ng-model="currentCommodity.commodityName" ng-disabled="{{editBusinessFlag}}" ng-options="commodityitem.commodityName for commodityitem in commodityList">
</select>
非常感谢任何帮助。
答案 0 :(得分:1)
请尝试以下代码:
You selected : {{currentCommodity.commodityName}}
<select class="form-control selection_size" ng-model="currentCommodity" ng-options="commodityitem.commodityName for commodityitem in commodityList">
</select>