【发布时间】:2014-10-18 08:54:20
【问题描述】:
我的任务很简单。我可以为来自 restful api 的文本框设置值。我可以使用 {{currentCommodity.commodityName}} 获取并显示在原始 HTML 页面上但是,甚至无法为选择标签设置值虽然我能够获得价值。
我的代码是
$scope.editCommodity = function(commodityIndex) {
console.log("commodities object",$scope.commoditiesAdded[commodityIndex].commodityName);
$scope.currentCommodity.commodityName = $scope.commoditiesAdded[commodityIndex].commodityName;
}
它返回一个带有稻谷的商品名称..
我的 HTML 代码
---{{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>
任何帮助将不胜感激。
【问题讨论】:
-
我不确定我是否完全理解了这个要求,但这会有帮助吗? getting the ng-object selected with ng-change
-
可以分享到jsfiddle吗?
-
@Archana,非常简单。我只想将值分配给选择标签。我希望我能创造一个小提琴,但我现在不能。
-
Ok Mahesh 我会尽力为您的问题提供解决方案
-
我认为该问题的答案可以帮助您:stackoverflow.com/questions/17815036/…
标签: javascript angularjs