I'm developing Timesheet application. I have ready layout (html/css). Currently I'm working on layout behavior. My current goal is extracting timesheet table header in directive. Angular template html should look similar to this:
<colgroup class="col_day">
<col ng-repeat="day in header.days" ng-class="someConditions">
</colgroup>
<thead>
<tr>
<th ng-repeat="day in header.days" ng-class="someConditions">
{{someLayout}}
</th>
</tr>
</thead>
I want to use this template via directive like this:
<table>
<timesheet-header></timesheet-header>
<tbody></tbody>
<tfoot></tfoot>
</table>
Problems:
- Angular doesn't allow to use multiple roots in template in directives with replace: true
- Template content appears outside of tag (only if template contains single tag it is rendered inside table
I have only bad solutions:
- Create two different directives for colgroup and thead (this solves multiple roots, but html will still appear outside table tag)
- keep template binding results invisible and prepend copy of generated html to table (by jquery)
- use the directive as attribute for table tag... I tried but this removes all other table content (I tried transclude)...
Note: I'm using AngularJS v1.4.3. Debugging in latest Google Chrome.
tabletag?