This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed
docs/content/error/$compile Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ @ngdoc error
2
+ @name $compile:reqslot
3
+ @fullName Required transclusion slot
4
+ @description
5
+
6
+ This error occurs when a directive or component try to transclude a slot that is not provided.
7
+
8
+ Transcluded elements must contain something. This error could happen when you try to transclude a self closing tag element.
9
+ Also you can make a transclusion slot optional with a `?` prefix.
10
+
11
+ ```js
12
+ // In this example the <my-component> must have an <important-component> inside to transclude it.
13
+ // If not, a reqslot error will be generated.
14
+
15
+ var componentConfig = {
16
+ template: 'path/to/template.html',
17
+ tranclude: {
18
+ importantSlot: 'importantComponent', // mandatory transclusion
19
+ optionalSlot: '?optionalComponent', // optional transclusion
20
+ }
21
+ };
22
+
23
+ angular
24
+ .module('doc')
25
+ .component('myComponent', componentConfig)
26
+
27
+ ```
28
+
29
+ ```html
30
+ <!-- Will not work because <important-component> is missing -->
31
+ <my-component>
32
+ </my-component>
33
+
34
+ <my-component>
35
+ <optional-component></optional-component>
36
+ </my-component>
37
+
38
+ <!-- Will work -->
39
+ <my-component>
40
+ <important-component></important-component>
41
+ </my-component>
42
+
43
+ <my-component>
44
+ <optional-component></optional-component>
45
+ <important-component></important-component>
46
+ </my-component>
47
+ ```
You can’t perform that action at this time.
0 commit comments