Skip to content

Arbitrary options

Choose a tag to compare

@poteto poteto released this 03 Apr 18:55
· 321 commits to master since this release

You can now pass arbitrary options to messages, thanks to @cowboyd for this one!

Ember.get('flashMessages').success('Cool story bro', {
  someOption : 'hello'
});

Ember.get('flashMessages').add({
  message  : 'hello',
  type     : 'foo',
  template : 'some-template',
  context  : customContext
});

For example, this allows the template that ultimately renders the flash to be as rich as it needs to be:

{{#each flashMessages.queue as |flash|}}
  {{#flash-message flash=flash as |component flash|}}
    {{#if flash.template}}
      {{render flash.template flash.context}}
    {{else}}
      <h6>{{component.flashType}}</h6>
      <p>{{flash.message}}</p>
    {{/if}}
  {{/flash-message}}
{{/each}}
Changelog
  • #43 Updated ember-cli to 0.2.2
  • #34 Pass arbitrary options to flash messages