Data Down

At this point the alert does not have any state data to render content and classNames, only containers. Pass in the state of the component in app/templates/application.hbs:

...
  {{flash-alert message="This is the Alert Message" alertType="success"}}
  {{outlet}}
</div>

Start the server and open your browser to http://​localhost:4200/​sightings to see the {{flash-alert}} component rendered with the inline data you supplied (Figure 25.3).

Figure 25.3  Flash alert

Flash alert

Now that the alert is on the screen, you want to set the properties of message and alertType dynamically. You will need an application controller to achieve ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.