diff options
| author | Misko Hevery | 2013-08-01 16:01:41 -0700 | 
|---|---|---|
| committer | Igor Minar | 2013-08-08 18:58:08 -0700 | 
| commit | 4175377aaff9401f8b6c6f62ece71706ecb7f4ce (patch) | |
| tree | 515602d06f46e562808f8fd09bb10bd77a569ca8 /docs/content/error/compile/tplrt.ngdoc | |
| parent | dbd703a9fb864b787bc90c45fd4eb5ded7422f24 (diff) | |
| download | angular.js-4175377aaff9401f8b6c6f62ece71706ecb7f4ce.tar.bz2 | |
docs(compile/tplrt): description for compile/tplrt error
Closes #3459
Diffstat (limited to 'docs/content/error/compile/tplrt.ngdoc')
| -rw-r--r-- | docs/content/error/compile/tplrt.ngdoc | 26 | 
1 files changed, 26 insertions, 0 deletions
| diff --git a/docs/content/error/compile/tplrt.ngdoc b/docs/content/error/compile/tplrt.ngdoc index 4afd88cd..78fe16b1 100644 --- a/docs/content/error/compile/tplrt.ngdoc +++ b/docs/content/error/compile/tplrt.ngdoc @@ -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! +``` | 
