« All deprecation guides
Deprecation Guide for Implicit Injections
until: 5.0.0
id: implicit-injections
Implicit injections have been deprecated since Ember v3.26.0. As of v4.0.0, implicit injections do nothing and should be removed based on suggestions in the original deprecation.
Before:
export default {
initialize(app) {
app.inject('route', 'store', 'service:store');
}
}
import { Route } from '@ember/routing/route';
export default class ApplicationRoute extends Route {
model() {
return this.store.findQuery('user', 123);
}
}
After:
import { Route } from '@ember/routing/route';
import { inject as service } from '@ember/service';
export default class ApplicationRoute extends Route {
@service store;
model() {
return this.store.findQuery('user', 123);
}
}
For a more detailed explanation with additional examples, see the 3.x deprecation guides.