我有一些html / angular:
<td class="col-md-4" colspan="4">
<label class="control-label ">{{item.fields[1].displayName}}11</label>
<div class="dropdown" style="width:100%">
<input type="text" class="form-control dropdown-toggle" data-toggle="dropdown" data-ng-disabled="formReadOnly" data-ng-model="item[item.fields[1].name]" data-ng-keyup="comboBoxGPIOptions(2, 70, item[item.fields[1].name], 'searchGpi')" />
<ul class="dropdown-menu" style="width:100%">
<li data-ng-repeat="name in searchGpi" style="width:100%"><a data-ng-click="changeData(item.fields[1].name, name);"><span class="GpiId">{{name}}</span></a></li>
</ul>
</div>
<label class="error" data-ng-show="issueSuppNum()">Please insert a valid GPI #.</label>
</td>
<td class="col-md-3" colspan="4">
<label class="control-label">{{item.fields[11].displayName}}22</label>
<div class="dropdown" style="width:100%">
<input type="text" class="form-control dropdown-toggle" data-toggle="dropdown" data-ng-disabled="formReadOnly" data-ng-model="GENERIC_NAME" data-ng-keyup="comboBoxGenOptions(2, 148, item[item.fields[11].name], 'searchGenericOptions')" />
<ul class="dropdown-menu" style="width:100%">
<li data-ng-repeat="name in searchGenericOptions" style="width:100%"><a data-ng-click="changeData('GENERIC_NAME', name)"><span class="GenId">{{name}}</span></a></li>
</ul>
</div>
<label class="error" data-ng-show="issueSuppNum()">Please insert a valid generic name.</label>
@*<div data-strat-form-control data-field-display-id="1" data-vmformreadonly="formReadOnly" data-show-tool-tip="showToolTip(item.fields[7].htmlName)" data-strat-model="item" data-field="item.fields[7]"></div>*@
</td>
注意:data-ng-click="changeData(item.fields[1].name, name);"
当此函数触发时,我想要2个不同的字段将文本更改为进入的对象:
这是:
$scope.changeData = function (propertyName, name) {
$scope.item[propertyName] = name;
jQuery('.GpiId').text(name.GPI);
jQuery('.GenId').text(name.GENERIC_NAME);
};
如果我检查通过它的对象名称是一个具有2个值的对象:
我想要将这两个字段发送回视图或使用jQuery更改值。我相信只有名字.GPI经历的原因是因为
$scope.changeData = function (propertyName, name) {
$scope.item[propertyName] = name.GPI;
jQuery('.GenId').text(name.GENERIC_NAME);
jQuery('.TherId').text(name.THER_CLASS_DESC);
我想要更改的文本的HTML中有一个span类:
<span class="GenId">{{name}}</span>
我做错了什么以及如何解决?