mirror of https://github.com/status-im/consul.git
5fb9df1640
* Adding explicit MPL license for sub-package This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Adding explicit MPL license for sub-package This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Updating the license from MPL to Business Source License Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at <Blog URL>, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl. * add missing license headers * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 --------- Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> |
||
---|---|---|
.. | ||
README.mdx | ||
index.js |
README.mdx
--- class: ember --- # Ref `<Ref @target={{this}} @name="api" @value={{api}} />` | Argument | Type | Default | Description | | --- | --- | --- | --- | | `target` | `Object` | | The object to assign the property/value to | | `name` | `String` | | The property name | | `value` | `Object` | | The value | `<Ref />` allows component users use an author defined public API of a component. The component is renderless in that it yields nothing to the DOM. The component takes a property name and value and sets it on the specified target, similar to the `{{ref this "name"}}` modifier. Occasionally it's necessary call actions belonging to a component from outside the component. For example, you may have a form that needs submitting by clicking a button in another area of the page. In order to do this, the button needs access to the `submit` action of the form component. This can be thought of as providing the public API for the component, the author of the component has control over what the user of the component can and can't call in this way. ### Example Here we provide a public API for a form component whilst authoring. ```hbs {{! /components/form/index.hbs }} <form onsubmit={{action "submit"}}> {{yield (hash focus=(action "focus") submit=(action "submit") cancel=(action "cancel") )}} ... <button type="submit">Submit</button> </form> ``` The user of the component now has access to the public API of the ember/glimmer `<Form>` component, in the same way that using the `{{ref}}` modifier gives the user access to the public API of native DOM elements (for example `<input {{ref this 'input'}}/>` / `this.input.focus()`). ```hbs {{! /templates/index.hbs}} <Form as |api|> <Ref @target={{this}} @name="form" @value={{api}} /> </Form> ... <button type="button" onclick={{action this.form.submit}}}></button> ``` ### See - [Component Source Code](./index.js) ---