adopted-ember-addons / ember-cli-flash

Simple, highly configurable flash messages for ember-cli
https://www.npmjs.com/package/ember-cli-flash
MIT License
356 stars 113 forks source link

flashMessages is not working in newly create ember app #385

Open Randhir-93 opened 2 years ago

Randhir-93 commented 2 years ago
  1. Create a new app using ember new testApp
  2. Installed latest version of ember-cli-flash
  3. created a test component `import Component from "@glimmer/component"; import { inject as service } from "@ember/service";

export default class TestComponent extends Component { @service flashMessages;

constructor() {
    super(...arguments);
    setTimeout(() => {
        this.flashMessages.alert("dsfsf");
    }, 1000)
}

}` Calling TestComponent from application.hbs but flash message is not showing.

charlesfries commented 1 year ago

Make sure you are also displaying the message queue somewhere in the template:

{{#each this.flashMessages.queue as |flash|}}
  <FlashMessage @flash={{flash}} />
{{/each}}