knowhow-server
Version:
A personal workflow engine that can manage and use any network connected host
31 lines (30 loc) • 1.99 kB
HTML
<a href="http://github.com/angular/angular.js/edit/master/docs/content/error/compile/tplrt.ngdoc" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">Invalid Template Root</code>
<div><span class="hint">error in component <code ng:non-bindable="">$compile</code>
</span>
</div>
</h1>
<div><pre class="minerr-errmsg" error-display="Template for directive '{0}' must have exactly one root element. {1}">Template for directive '{0}' must have exactly one root element. {1}</pre>
<h2 id="description">Description</h2>
<div class="description"><div class="-compile-page -compile-tplrt-page"><p>When a directive is declared with <code>template</code> (or <code>templateUrl</code>) and <code>replace</code> mode on, the template
must have exactly one root element. That is, the text of the template property or the content
referenced by the templateUrl must be contained within a single html element.
For example, <code><p>blah <em>blah</em> blah</p></code> instead of simply <code>blah <em>blah</em> blah</code>.
Otherwise, the replacement operation would result in a single element (the directive) being replaced
with multiple elements or nodes, which is unsupported and not commonly needed in practice.</p>
<p>For example a directive with definition:</p>
<pre><code>myModule.directive('myDirective', function factory() {
return {
...
replace: true,
templateUrl: 'someUrl'
...
}
});</code></pre>
<p>And a template provided at URL <code>someUrl</code>. The template must be an html fragment that has only a
single root element, like the <code>div</code> element in this template:</p>
<pre><code><div><b>Hello</b> World!</div></code></pre>
<p>An an invalid template to be used with this directive is one that defines multiple root nodes or
elements. For example:</p>
<pre><code><b>Hello</b> World!</code></pre>
</div></div>
</div>