title: With ui-grid, how to access $scope from nested rows?
body: <p>On the first level row, I can access <code>$scope</code> by <code>grid.appScope</code>.
  But in the second level row, I have a clue what <code>grid.appScope</code> returns.</p>
  
  <p>I have a checkbox in a column of the second level row, when a user clicks, I need to call a method. On the first level row, I can do like below</p>
  
  <pre><code>$scope.update_field = function...
  </code></pre>
  
  <p>then in <code>columndef</code>, I add <code>ng-click="grid.appScope.update_field</code>...</p>
  
  <p>How do I do the similar on the second level row?</p>
  
  <p>Below is the code, now, the <code>checkfield</code> works, but cannot make <code>subcheckfield</code> work.</p>
  
  <pre><code>controller('ctrlProductAssignment', function ($scope, $controller, $routeParams, api, libs, options, gui) {
  
      $scope.update_field = function (rowEntity, colDef, newValue, oldValue) {
          if (rowEntity.id &gt; 0)
            ....
      };
  
      $scope.gridOptions = {
          onRegisterApi: function (gridApi) {
              $scope.gridApi = gridApi;
  
              gridApi.expandable.on.rowExpandedStateChanged($scope, function (row) {
                  if (row.isExpanded) {
                      row.entity.subGridOptions = {
                          columnDefs: [
                               { name: 'subcheckfield', displayName: 'Registered', 
                                cellTemplate: '&lt;input type="checkbox" ng-model="row.entity[col.name]" ng-click="grid.appScope.update_field(row.entity, { name:col.name }, row.entity[col.name], 0)"&gt;' },
                            ]
                      };
  
                      api.raffle_productassignmentdetail.query({ raffle_id: $scope.deal.id, pa_id: row.entity.id }).$promise.then(function (response) {
                          row.entity.subGridOptions.data = response;
                      });
                  }
              });
          },
  
          columnDefs: [
           { name: 'checkfield', displayName: 'Registered',                               
             cellTemplate: '&lt;input type="checkbox" ng-model="row.entity[col.name]" ng-click="grid.appScope.update_field(row.entity, { name:col.name }, row.entity[col.name], 0)"&gt;' },
          ]
      };
  
      api.raffle_productassignment.query({ raffle_id: $scope.deal.id, reseller_id: reseller_id }).$promise.then(function (response) {
          $scope.gridOptions.data = response;
      });
  }
  </code></pre>