You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/error/compile/tplrt.ngdoc
+26
Original file line number
Diff line number
Diff line change
@@ -2,3 +2,29 @@
2
2
@name $compile:tplrt
3
3
@fullName Invalid Template Root
4
4
@description
5
+
6
+
When a directive is declared with `template` (or `templateUrl`) and `replace` mode on, the template must have exactly one root element.
7
+
Otherwise the replacement operation would result in a single element being replaced with multiple elements or nodes, which is unsupported and not commonly needed in practice.
8
+
9
+
10
+
For example a directive with definition:
11
+
```
12
+
myModule.directive('myDirective', function factory() {
13
+
return {
14
+
...
15
+
replace: true,
16
+
templateUrl: 'someUrl'
17
+
...
18
+
}
19
+
});
20
+
```
21
+
22
+
And a template provided at URL `someUrl`. The template must be an html fragment that has only a single root element, like the `div` element in this template:
23
+
```
24
+
<div><b>Hello</b> World!</div>
25
+
```
26
+
27
+
An an invalid template to be used with this directive is one that defines multiple root nodes or elements. For example:
0 commit comments