ember-is-component
v1.0.0
Published
Provides a helper to check if a component exists.
Downloads
1
Maintainers
Readme
ember-is-component
Provides a helper to check if a component exists.
Compatibility
- Ember.js v3.28 or above
- Embroider or ember-auto-import v2
Installation
ember install ember-is-component
Usage
This addon provides a helper that checks if a component exists. A component exists if a factory for it is found in the helper's owner.
is-component
helper is useful if your context makes the existence of a component uncertain (for instance if the name is generated dynamically or if a dependency may or may not provide it...) and you want to check the component's existence before instantiating it safely.
{{#if (is-component "my-component")}}
<MyComponent />
{{else}}
<p>MyComponent was not found.</p>
{{/if}}
Contributing
See the Contributing guide for details.
License
This project is licensed under the MIT License.