Not able to use ngRepeat to generate table <td>s
Hello,
Can anyone please help me to generate the dynamic < td >s in the table? Not working: < tbody> < tr> < td ng-repeat="col in columns"> {{ col }} < /td> < /tr> < /tbody>
However, ngRepeat for other tags is working: < tbody> < tr> < td> < p ng-repeat="col in columns"> {{ col }} < /p> < /td> < /tr> < /tbody>
It's possible.
- add ng-non-bindable attribute to your tbody see here. It will prevent to compile ng-repeat by angular before directive will be compiled.
- if
columnsis a property of controller scope - it should be $owner.columns.
Thanks a lot man, it worked for < td>s But I'm facing issues while generating < th>s using ngRepeat. I'm able to generate the < th>s dynamically using ngRepeat, but the issue is with column drag.
When I'm trying to drag a column I'm getting: TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
Here is my code: HTML: < table object-table data="users" headers="Fname,Lname,Phone,Email" fields="columns" sorting="no" paging="no" search="no" display="recPerPage"> < thead> < tr> < th ng-repeat="col in $owner.columns" allow-drag> {{ col.title }} < /th> < /tr> < /thead> < tbody ng-non-bindable> < tr> < td ng-repeat="col in $owner.columns"> {{ ::item[col.field] }} < /td> < /tr> < /tbody> < /table>
I have tried "ng-non-bindable" on < thead> as well as on < th> of table header, but not useful here.
So, anyway I can generate dynamic < th>s with ngRepeat and which are also draggable?
Thanks