Actions Up

Now you have an action to set the flash-alert to display the appropriate message. You just need to pass the action some data. That data will be an object with keys for alertType and message.

The alertType will be a part of both the message and the style with Bootstrap alert variants: "success", "warning", "info", or "danger". Calling the action from a controller will look like this:

this.send('flash', {alertType: "success", message: "You Did It! Hooray!"});

You will be adding the call to the application action after creating a new sighting. In app/routes/sightings/new.js, add the following:

...
    create() {
      var self = this;
      this.get('sighting').save().then(function(data){
        self.send('flash', {alertType: "success", message: ...

Get Front-End Web Development: The Big Nerd Ranch Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.