`{{is-component}}` helper for your Ember apps
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
addon
app
config
tests
vendor
.editorconfig
.ember-cli
.eslintrc.js
.gitignore
.npmignore
.travis.yml
.watchmanconfig
LICENSE.md
README.md
ember-cli-build.js
index.js
package-lock.json
package.json
testem.js

README.md

ember-cli-is-component TravisCI Badge

This addon provides a new helper: is-component to be used as follows:

{{is-component componentName}}

The helper returns true when the first parameter can be looked up a component; false otherwise.

Example with the {{component}} helper

The {{component}} helper throws an error when an invalid component name is given as parameter. Used with {{if}}, the (is-component) helper offers a nice failsafe to avoid the rendering error when the component may not exist:

{{#if (is-component componentName)}}
  {{component componentName}}
{{else}}
  Sorry, {{componentName}} is not a known component.
{{/if}}

Example as a computed property

isComponent: inject(),
exists: computed(function() {
  return this.get('isComponent').test('my-component');
})

Installation

  • git clone this repository
  • npm install
  • bower install

Running

Running Tests

  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://www.ember-cli.com/.