Loading Data from Routes
Learn to return data to templates from route handlers.
We'll cover the following
In most cases, our data comes from a database. Let’s see how route handlers load the data into Ember routes.
Route handlers
We have a model
hook in the route handler that’s responsible for loading data. A hook is simply a method that’s called automatically on some action in our application. Whenever a certain route is visited by the user, its model()
hook is called to load the data. Let’s see how we can add a model()
hook in our route handler. Let’s load our admin
route handler from app/routes/admin.js
:
Get hands-on with 1400+ tech skills courses.