Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Loading a template (url or string) in a directive with root element invalid as div chidlren throw Error: Template must have exactly one root element #2848

Closed
carlo-colombo opened this issue Jun 1, 2013 · 5 comments

Comments

@carlo-colombo
Copy link

I have a template with a single tr as root

<tr>
  <td>
    <code>{{method}}</code>
  </td>
  <td>
    <a class="btn" ng-click="{{action}}">run</a>
  </td>
  <td ng-transclude></td>
</tr>

when the template is compiled the source is wrapped with a div to get the content. tds and trs are not valid children of a div so they are stripped out from the DOM leaving code and a tags

jsbin: http://jsbin.com/eyodiq/4

screenshot4

@btford btford closed this as completed Aug 24, 2013
@btford
Copy link
Contributor

btford commented Aug 24, 2013

As part of our effort to clean out old issues, this issue is being automatically closed since it has been inactivite for over two months.

Please try the newest versions of Angular (1.0.8 and 1.2.0-rc.1), and if the issue persists, comment below so we can discuss it.

Thanks!

@carlo-colombo
Copy link
Author

Tested with 1.2.0-rc.1 and the problem is still present http://jsbin.com/IviLado/1/edit
Template content is not rendered and an exception is raised.

@atdrago
Copy link

atdrago commented Dec 2, 2013

+1 This is still an issue as of 1.2.3

@caitp
Copy link
Contributor

caitp commented Dec 2, 2013

I'm bored, I'll try and write a patch to make this work if I don't see any pull requests already opened

@atdrago
Copy link

atdrago commented Dec 2, 2013

@caitp Thank you!

caitp pushed a commit that referenced this issue Feb 14, 2014
If the first element in a template is a <tr>, <th>, <td>, or <tbody> tag,
the HTML compiler will ensure that the template is wrapped in a <table>
element so that the table content is not discarded.

Closes #2848
Closes #1459
Closes #3647
Closes #3241
khepin pushed a commit to khepin/angular.js that referenced this issue Feb 19, 2014
If the first element in a template is a <tr>, <th>, <td>, or <tbody> tag,
the HTML compiler will ensure that the template is wrapped in a <table>
element so that the table content is not discarded.

Closes angular#2848
Closes angular#1459
Closes angular#3647
Closes angular#3241
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants