Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit cee2c4c

Browse files
JoshuaJWilbornNarretz
authored andcommitted
docs ($compile): add error documentation for noslot error in $compile
Fixes #15790 Closes #15828
1 parent a5160c8 commit cee2c4c

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
@ngdoc error
2+
@name $compile:noslot
3+
@fullName No matching slot in parent directive
4+
@description
5+
6+
This error occurs when declaring a specific slot in a {@link ng.ngTransclude `ngTransclude`}
7+
which does not map to a specific slot defined in the transclude property of the directive.
8+
9+
In this example the template has declared a slot missing from the transclude definition.
10+
This example will generate a noslot error.
11+
```js
12+
var componentConfig = {
13+
template: '<div>' +
14+
'<div ng-transclude="slotProvided"></div>' +
15+
'<div ng-transclude="noSlotProvided"></div>' +
16+
'</div>',
17+
transclude: {
18+
// The key value pairs here are considered "slots" that are provided for components to slot into.
19+
slotProvided: 'slottedComponent', // mandatory transclusion
20+
// There is no slot provided here for the transclude 'noSlotProvided' declared in the above template.
21+
}
22+
};
23+
```
24+
25+
If we make the following change we will no longer get the noslot error.
26+
```js
27+
var componentConfig = {
28+
template: '<div>' +
29+
'<div ng-transclude="slotProvided"></div>' +
30+
'<div ng-transclude="noSlotProvided"></div>' +
31+
'</div>',
32+
transclude: {
33+
slotProvided: 'slottedComponent',
34+
noSlotProvided: 'otherComponent' // now it is declared and the error should cease
35+
}
36+
};
37+
38+
```

0 commit comments

Comments
 (0)