获取 ngTable 指令的列值
Get the column value of the ngTable directive
我正在使用 ngTable 指令作为我的 grid.So 我需要在不使用任何按钮的情况下捕获行的文本框值更改(请参见下图)。如何使用 $watch
或其他方法来做到这一点?任何帮助将不胜感激。
html
<table class="table" ng-table="UnitsParams" template-pagination="custom/pager">
<tr ng-repeat="item in Event.UnitsDetails">
<td data-title="'Name'" sortable="'FirstName'">{{item.FirstName}} {{item.LastName}}</td>
<td data-title="'Email'"><a href="mailTo:{{item.Email}}">{{item.Email}}</a></td>
<td data-title="'Units'"><input type="number" ng-model="item.Units" />
</td>
</tr>
</table>
在文本框中尝试 ng-blur
类似于
<td data-title="'Units'"><input type="number" ng-blur="getValue(item)" ng-model="item.Units" /></td>
javascript 控制器中的代码看起来像
$scope.getValue=function(item)
{
alert(item.Units)
}
我正在使用 ngTable 指令作为我的 grid.So 我需要在不使用任何按钮的情况下捕获行的文本框值更改(请参见下图)。如何使用 $watch
或其他方法来做到这一点?任何帮助将不胜感激。
html
<table class="table" ng-table="UnitsParams" template-pagination="custom/pager">
<tr ng-repeat="item in Event.UnitsDetails">
<td data-title="'Name'" sortable="'FirstName'">{{item.FirstName}} {{item.LastName}}</td>
<td data-title="'Email'"><a href="mailTo:{{item.Email}}">{{item.Email}}</a></td>
<td data-title="'Units'"><input type="number" ng-model="item.Units" />
</td>
</tr>
</table>
在文本框中尝试 ng-blur
类似于
<td data-title="'Units'"><input type="number" ng-blur="getValue(item)" ng-model="item.Units" /></td>
javascript 控制器中的代码看起来像
$scope.getValue=function(item)
{
alert(item.Units)
}