ui:context
View as MarkdownReads the context of the closest enclosing component of another type.
Use it when a nested component needs something from an ancestor, for example a custom button inside a dialog:
<ui:context name="ui:dialog" as="dialogContext" />
name is the component with its namespace, as you write its tag, and as the variable that receives its context. A component reads its own context through the context variable. Asking ui:context for it throws an exception.
With provider it reads the context a <component>.provider created instead, from anywhere after the provider, also outside a component:
<ui:dialog.provider id="contact" />
<ui:context name="ui:dialog" provider="contact" as="contactDialog" />
Arguments
Permalink to heading "Arguments"| Name | Type | Description | Required | Default |
|---|---|---|---|---|
name |
string | The component with its namespace, as you write its tag (e.g. "ui:fileUpload") | Yes | - |
as |
string | Variable name to assign the result to | No | '' |
provider |
string | The id of a <component>.provider to read the context of, instead of the closest enclosing component. |
No | '' |