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

docs ($compile): add error documentation for noslot error in $compile #15828

Merged
merged 6 commits into from
Mar 22, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions docs/content/error/$compile/noslot.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
@ngdoc error
@name $compile:noslot
@fullName No matching slot in parent directive
@description

This error occurs when declaring a specific slot in a {@link ng.ngTransclude `ngTransclude`}
which does not map to a specific slot defined in the transclude property of the directive.

In this example the template has declared a slot missing from the transclude definition.
This example will generate a noslot error.
```js
var componentConfig = {
template: '<div>' +
'<div ng-transclude="slotProvided"></div>' +
'<div ng-transclude="noSlotProvided"></div>' +
'</div>',
transclude: {
// The key value pairs here are considered "slots" that are provided for components to slot into.
slotProvided: 'slottedComponent', // mandatory transclusion
// There is no slot provided here for the transclude 'noSlotProvided' declared in the above template.
}
};
```

If we make the following change we will no longer get the noslot error.
```js
var componentConfig = {
template: '<div>' +
'<div ng-transclude="slotProvided"></div>' +
'<div ng-transclude="noSlotProvided"></div>' +
'</div>',
transclude: {
slotProvided: 'slottedComponent',
noSlotProvided: 'otherComponent' // now it is declared and the error should cease
}
};

```