Home

Awesome

ember-spread

Dynamic options for dynamic components

Dependencies

Ember NPM

Health

Travis Coveralls

Security

bitHound

Ember Observer score

EmberObserver

Installation

ember install ember-spread

Details

A mixin that can be used to spread a property object against the top level of a component. Spread allows a component helper to be used without knowing the properties the target component will require.

E.g.

{{component fooComponent
  options=fooOptions
}}

Those options are then flattened onto the target component and observed as normal attributes on the component. So if fooComponent was my-button and fooOptions was { biz: 'baz' } the above would be the equivalent of:

{{my-button
  biz='baz'
}}

Data-driven scenarios will find this particularly useful, since both the component and properties can be retrieved from an external API

Installation

Demo

http://ciena-blueplanet.github.io/ember-spread/

Usage

Component

import SpreadMixin from 'ember-spread'

export default Ember.Component.extend(SpreadMixin, {
  ...
})

Template instance

{{component-foo
  options=bar
}}
{{component-foo
  baz=bar
  spreadOptions=(hash
    property='baz'
  )
}}