Search⌘ K
AI Features

Loading Data from Routes

Explore how Ember.js uses the model hook within route handlers to load data dynamically when routes are visited. Learn to replace hard-coded data in templates with data returned from route models, improving maintainability and scalability.

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 ...