7.0.2 • Published 4 years ago

ember-spread v7.0.2

Weekly downloads
1,061
License
MIT
Repository
github
Last release
4 years ago

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

  • ember install ember-spread

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
}}
  • The spread function operates based on the init lifecycle hook, so be sure to call this._super(...arguments) if your component also uses that hook
  • Spread only acts on an object hash (the hash helper can be used)
  • options is the default property that will be spread
  • If you need to customize the target property you can set the target using the spreadOptions property, i.e.
{{component-foo
  baz=bar
  spreadOptions=(hash
    property='baz'
  )
}}
7.0.2

4 years ago

7.0.1

6 years ago

7.0.0

6 years ago

6.0.1

6 years ago

6.0.0

6 years ago

5.1.0

6 years ago

5.0.2

6 years ago

5.0.1

6 years ago

5.0.0

6 years ago

4.0.1

6 years ago

4.0.0

6 years ago

3.1.5

6 years ago

3.0.3

6 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago