From f5acee1daf91dd1d6865660f1f7f12c08db4d3e2 Mon Sep 17 00:00:00 2001 From: Xavier Haniquaut Date: Mon, 16 May 2016 14:38:15 +0200 Subject: [PATCH 1/2] docs(error/$compile): add reqslot error definition Explains what could generate a reqslot error --- docs/content/error/$compile/reqslot.ngdoc | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 docs/content/error/$compile/reqslot.ngdoc diff --git a/docs/content/error/$compile/reqslot.ngdoc b/docs/content/error/$compile/reqslot.ngdoc new file mode 100644 index 000000000000..ec66875dc8f9 --- /dev/null +++ b/docs/content/error/$compile/reqslot.ngdoc @@ -0,0 +1,8 @@ +@ngdoc error +@name $compile:reqslot +@fullName Required transclusion slot +@description + +This error occurs when a directive or component try to transclude a slot that is not provided. + +Transcluded elements must contain something. This error could happen when you try to transclude a self closing tag element. From 6125ac80f821bc66e381eb8b5fbf096942362fd5 Mon Sep 17 00:00:00 2001 From: Xavier Haniquaut Date: Tue, 17 May 2016 16:02:19 +0200 Subject: [PATCH 2/2] docs(error/$compile): improve reqslot page Add examples and optional transclude slot informations. --- docs/content/error/$compile/reqslot.ngdoc | 39 +++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/docs/content/error/$compile/reqslot.ngdoc b/docs/content/error/$compile/reqslot.ngdoc index ec66875dc8f9..f3de08bf3f24 100644 --- a/docs/content/error/$compile/reqslot.ngdoc +++ b/docs/content/error/$compile/reqslot.ngdoc @@ -6,3 +6,42 @@ This error occurs when a directive or component try to transclude a slot that is not provided. Transcluded elements must contain something. This error could happen when you try to transclude a self closing tag element. +Also you can make a transclusion slot optional with a `?` prefix. + +```js +// In this example the must have an inside to transclude it. +// If not, a reqslot error will be generated. + +var componentConfig = { + template: 'path/to/template.html', + tranclude: { + importantSlot: 'importantComponent', // mandatory transclusion + optionalSlot: '?optionalComponent', // optional transclusion + } +}; + +angular + .module('doc') + .component('myComponent', componentConfig) + +``` + +```html + + + + + + + + + + + + + + + + + +```