Sampath
Sampath

Reputation: 65978

Get the column value of the ngTable directive

I'm using ngTable directive as my grid.So I need to capture the row's text box value change without using any button (Please see the image below).How can I use $watch or other method to do that ? Any help would be highly appreciated.

enter image description here

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>

Upvotes: 2

Views: 1001

Answers (1)

Ramesh Rajendran
Ramesh Rajendran

Reputation: 38693

Try ng-blur in your textbox

Something like

<td data-title="'Units'"><input type="number" ng-blur="getValue(item)" ng-model="item.Units" /></td>

javascript code looks like in your controller

$scope.getValue=function(item)
{
alert(item.Units)
}

Upvotes: 3

Related Questions