ng-table breaks with ng-include
Hi,
I am using ng-table in a directive and attempting to include different templates based on different data passed into the directive. Here was my first pass:
<table ng-table="tl.tableParams">
<tbody ng-repeat="group in $groups" ng-if="$groups.length > 0">
<tr class="ng-table-group monthHeader">
<th colspan="{{$columns.length}}">
<span class="fa" ng-class="{ 'fa-caret-right': group.$hideRows, 'fa-caret-down': !group.$hideRows }"></span>
<span>{{group.value | date : tl.options.groupFormatter}}</span>
</a>
</th>
</tr>
<!-- individual transaction -->
<tr ng-hide="group.$hideRows" ng-repeat="transaction in group.data"
ng-include="tl.columnRenderer()">
</tr>
</tbody>
</table>
This fails with the following error: TypeError: Cannot set property '$groups' of null
It seems to be based on the fact that ng-include creates a child scope and while all of the parent scope properties are available, the ng-table directive seems to be copying the scope value to a local variable at some initialization point.
Have you done this before? Is this a supported use case?
Thanks!
Yes, ngTable creates isolated scope.
As i assume "TypeError: Cannot set property '$groups' of null" happens in your function tl.columnRenderer(). Please provide function content. Maybe you can just call columnRenderer with aogument group: `tl.columnRenderer(group)" or whatever you need.