title: How to access current row data in angular-datatables using templates?
body: <p>I am using <a href="http://l-lin.github.io/angular-datatables/" rel="nofollow">angular-datatables</a>. There is a column <code>Actions</code> which I render using an inline template. I want to access current row data in that template. How do that?</p>
  
  <p><strong>controller</strong></p>
  
  <pre><code>$scope.dtOptions = DTOptionsBuilder.newOptions().withOption('ajax', {
          url: '/api/department',
          type: 'GET'
      })
      .withDataProp('data')
      .withOption('processing', true)
      .withOption('serverSide', true)
      .withPaginationType('full_numbers')
      .withOption('createdRow', function (row, data, dataIndex) {
          return $timeout(function() {
              // Recompiling so we can bind Angular directive to the DT
              return $scope.$apply($compile(angular.element(row).contents())($scope));
          });
      })
      .withBootstrap();
  $scope.dtColumns = [
      DTColumnBuilder.newColumn('id').withTitle('ID'),
      DTColumnBuilder.newColumn('name').withTitle('Name'),
      DTColumnBuilder.newColumn('actions').withTitle('Actions').withOption("searchable", false)
  ];
  </code></pre>
  
  <p><strong>view</strong></p>
  
  <pre><code>&lt;div class="hbox hbox-auto-xs hbox-auto-sm" ng-controller="DepartmentsController"&gt;
      &lt;!-- Inline Template --&gt;
      &lt;script type="text/ng-template" id="actions.html"&gt;
           &lt;button class="btn btn-primary btn-xs" 
                ng-click="edit(/** CURRENT ROW ELEMENT ID */)"&gt;&lt;i class="fa fa-edit"&gt;&lt;/i&gt; Edit&lt;/button&gt;
           &lt;button class="btn btn-danger btn-xs" 
                ng-click="delete()"&gt;&lt;i class="fa fa-trash"&gt;&lt;/i&gt; Delete&lt;/button&gt;
      &lt;/script&gt;
      &lt;div class="bg-light lter b-b wrapper-md"&gt;
          &lt;h1 class="m-n font-thin h3"&gt;Departments&lt;/h1&gt;
      &lt;/div&gt;
      &lt;div class="wrapper-md"&gt;
          &lt;div class="panel panel-default"&gt;
              &lt;div class="panel-body"&gt;
                  &lt;div class="row"&gt;
                      &lt;div class="col-xs-6"&gt;
                          &lt;button class="btn m-b-md btn-md btn-primary " ui-sref="manager.departments.create"&gt;
                              &lt;i class="fa fa-plus"&gt;&lt;/i&gt; &lt;span class="hidden-sm hidden-xs"&gt;Add Department&lt;/span&gt;&lt;/button&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="row"&gt;
                      &lt;div class="col-sm-12 m-b-xs"&gt;
                          &lt;table datatable="" dt-options="dtOptions" dt-columns="dtColumns" class="table table-striped b-t b-b"&gt;
                              &lt;thead&gt;
                                  &lt;tr&gt;
                                      &lt;th style="width:20%"&gt;ID&lt;/th&gt;
                                      &lt;th style="width:60%"&gt;Name&lt;/th&gt;
                                      &lt;th style="width:20%"&gt;Actions&lt;/th&gt;
                                  &lt;/tr&gt;
                              &lt;/thead&gt;
                          &lt;/table&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Here is plunkr to help you: <a href="http://plnkr.co/edit/iAZBof7g6cp68RnM0X8H?p=preview" rel="nofollow">http://plnkr.co/edit/iAZBof7g6cp68RnM0X8H?p=preview</a></p>