Skip to content

Commit

Permalink
docs(compile/tplrt): description for compile/tplrt error
Browse files Browse the repository at this point in the history
  • Loading branch information
mhevery authored and IgorMinar committed Aug 9, 2013
1 parent dbd703a commit 4175377
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions docs/content/error/compile/tplrt.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,29 @@
@name $compile:tplrt
@fullName Invalid Template Root
@description

When a directive is declared with `template` (or `templateUrl`) and `replace` mode on, the template must have exactly one root element.
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.


For example a directive with definition:
```
myModule.directive('myDirective', function factory() {
return {
...
replace: true,
templateUrl: 'someUrl'
...
}
});
```

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:
```
<div><b>Hello</b> World!</div>
```

An an invalid template to be used with this directive is one that defines multiple root nodes or elements. For example:
```
<b>Hello</b> World!
```

0 comments on commit 4175377

Please sign in to comment.