File tree 1 file changed +45
-0
lines changed
docs/content/error/$compile
1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change
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 ng-transclude which does not map to the transclude property of the directive.
7
+
8
+ ```js
9
+ // In this example the template has a declared slot missing from the transclude definition.
10
+ // This example will generate a no slot error.
11
+
12
+ var componentConfig = {
13
+ template: '<div style="border: 1px solid black;">' +
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
+ optionalSlot: '?optionalComponent', // optional transclusion
21
+ // there is no slot provided for the transclude 'noSlotProvided' declared in the above template
22
+ }
23
+ };
24
+
25
+ angular
26
+ .module('doc')
27
+ .component('myComponent', componentConfig)
28
+
29
+ ```
30
+
31
+ ```js
32
+ \\ if we the following change we will no longer get no slot error.
33
+ var componentConfig = {
34
+ template: '<div style="border: 1px solid black;">' +
35
+ '<div ng-transclude="slotProvided"></div>' +
36
+ '<div ng-transclude="noSlotProvided"></div>' +
37
+ '</div>',
38
+ transclude: {
39
+ slotProvided: 'slottedComponent', // mandatory transclusion,
40
+ optionalSlot: '?optionalComponent', // optional transclusion,
41
+ noSlotProvided: 'otherComponent' // now it is declared and the error should cease
42
+ }
43
+ };
44
+
45
+ ```
You can’t perform that action at this time.
0 commit comments