Set Your Model
When we’re working with a route, the model hook is used to load and supply the necessary data. As we’ve seen, not every route will implement its model hook, but most will. The model hook is a function, defined within an instance of a Route class, that loads the data to be displayed by that route.
In the EmberNote app, we haven’t yet built a route that makes use of the model hook. Let’s do so now. When a user signs in via the login action, we use the transitionTo function to transition to the notebooks route. Let’s define that route now, and along the way we’ll see how to use the model hook.
The notebooks route has a simple purpose: to display a list of the notebooks a user has created in EmberNote. A notebook is a collection ...
Get Deliver Audacious Web Apps with Ember 2 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.