我使用AngularJS和Web API从SQL表加载数据。我创建了一个函数,当从HTML表中选择一行时,它会在输入文本中显示值。当我在调试时单击html表上的任何行时出现此错误。
HTML
<td>Code</td>
<td><input type="text" size="10" pattern="^[a-zA-Z0-9]+$" title="Alphnumeric" required autofocus ng-model="selectedMember.Code.Staff_Type_Code">
<input type="text" size="10" hidden ng-model="selectedMember.sys_key" /> </td>
</tr>
<tr>
<td>Latin Description</td>
<td><input type="text" required size="35" ng-model="selectedMember.Latin.L_Desc"></td>
</tr>
<tr>
<td>Local Description</td>
<td><input type="text" required size="35" ng-model="selectedMember.Local.A_Desc"></td>
</tr>
<tbody>
<tr ng-repeat="c in Contracts | filter:selectedMember.Code | filter:selectedMember.Latin | filter:selectedMember.Local ">
<td style="display:none;"><a href="#" ng-click="showInEdit(c)">{{c.sys_key}}</a></td>
<td><a href="#" ng-click="showInEdit(c)">{{c.Staff_Type_Code}}</a></td>
<td><a href="#" ng-click="showInEdit(c)">{{c.L_Desc}}</a></td>
<td><a href="#" ng-click="showInEdit(c)">{{c.A_Desc}}</a></td>
<td><a href="#" ng-click="showInEdit(c)">{{c.Hours_Day}}</a></td>
<td><a href="#" ng-click="showInEdit(c)">{{c.Days_Week}}</a></td>
<td><a href="#" ng-click="showInEdit(c)">{{c.Type_EndWork}}</a></td>
<td><a href="#" ng-click="showInEdit(c)">{{c.Num_EndWork}}</a></td>
</tr>
</tbody>
Controller.js
$scope.selectedMember = { Code: "",sys_key:"", Latin:"" , Local:"", Hours_Day :"", Days_Week:"", Num_EndWork:"" }
$scope.showInEdit = function (member)
{
debugger;
$scope.selectedMember = member;
$scope.selectedMember.Code = member;
$scope.selectedMember.Latin = member;
$scope.selectedMember.Local = member;
}
当我评论最后3行时,所选行值不会显示在输入文本中。或者我必须取消过滤器。是否有办法同时兼顾两者 任何帮助将不胜感激,提前谢谢
答案 0 :(得分:0)
如果您不小心导入/嵌入相同的JS文件两次,有时可以获得此信息,值得在检查员的资源选项卡中进行检查。或者如果你正在调用一个调用另一个函数的函数,等等。