Route Actions

Actions are not just for controllers. Routes can declare the actions for templates and override lifecycle actions. When an action is called, it bubbles up from the template to the controller to the route and to parent routes.

A route can therefore act as the controller when a controller definition is not needed. This might seem contradictory after all our talk about separating the application concerns, but Ember really split the controller’s job into two units: route information and controller logic. Sometimes the route file has more logic and sometimes the controller has more logic. The file separation allows for small digestible chunks of code when the other file has numerous actions or decorators.

To see how this ...

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.