Injecting a Service

You’ll learn how to access services using inject in an Ember application in this lesson.

We'll cover the following

inject as a service

The way to get access to services in the app is to inject them. Here, the verb “inject” refers to the underlying dependency injection mechanism. A common way to do this is to alias the imported “inject” function as “service.” This makes it very apparent that we’re using a service.

Now, we still need to change the route because we’re creating three static bands in the route and not adding them to the catalog at the moment. We’ll also have to return the bands in the catalog so that we can keep going through each @model in the template:

The removed code is commented, and the newly added code is highlighted.

Get hands-on with 1200+ tech skills courses.