Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7974f63

Browse files
authored
add nested outlet property documentation (#696)
1 parent b73bef7 commit 7974f63

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

docs/reference/outlets.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,24 @@ For each outlet defined in the `static outlets` array, Stimulus adds five proper
7979
| Singular | `[name]OutletElement` | `Element` | Returns the Controller `Element` of the first `[name]` outlet or throws an exception if none is present
8080
| Plural | `[name]OutletElements` | `Array<Element>` | Returns the Controller `Element`'s of all `[name]` outlets
8181

82+
**Note:** For nested Stimulus controller properties, make sure to omit namespace delimiters in order to correctly access the referenced outlet:
83+
84+
```js
85+
// chat_controller.js
86+
87+
export default class extends Controller {
88+
static outlets = [ "admin--user-status" ]
89+
90+
selectAll(event) {
91+
// returns undefined
92+
this.admin__UserStatusOutlets
93+
94+
// returns controller reference
95+
this.adminUserStatusOutlets
96+
}
97+
}
98+
```
99+
82100
## Accessing Controllers and Elements
83101

84102
Since you get back a `Controller` instance from the `[name]Outlet` and `[name]Outlets` properties you are also able to access the Values, Classes, Targets and all of the other properties and functions that controller instance defines:

0 commit comments

Comments
 (0)