Skip to content

BlueCutOfficial/ember-is-component

Repository files navigation

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.

About

Provides a helper to check if a component is registered

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •