我的html表单中的表在更新时不显示值。这是代码:
<div ng-controller='PersonalActionFieldController'>
<table>
<thead>
<tr>
<th>Personal Action Field(from Infor-Lawson)</th>
<th>Form Fields</th>
</tr>
</thead>
<tbody>
<select ng-model="name" ng-options="item.actionParam for item in actionFields"></select>
<tr ng-repeat="action in actionFields">
{{action.actionParam}}
</tr>
这是javascript:
function PersonalActionFieldController($scope, $http, $rootScope) {
$rootScope.$watch('actionTypeName',function(newActionTypeName) {
alert('hey, myVar has changed!');
$scope.actionFields = null;
$scope.httpData = '{"actionName":"'+$rootScope.actionTypeName+'"}';
$http.post('http://localhost:82/rs/transformTrigger/lawsonFields', $scope.httpData)
.success(function (data, status, headers, config) {
$scope.actionFields = data;
})
.error(function (data, status, headers, config) {
// Do some error handling here
alert('error');
});
});
}
答案 0 :(得分:0)
这不是角度问题,而是DOM元素的使用:tbody标签的允许内容是零个或多个tr元素,而不是select。 (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody)
如何将选择放在表格之外或tr标签内