As of Ember 4.0, implicit injection with application.inject has been disabled. This PR removes the long-deprecated implicit injection of the flash messages service into all routers, controllers, views, and components.
Migration guide
You should inject the service yourself wherever you need it.
For example, in a component:
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
export default class FlashComponent extends Component {
@service flashMessages;
}
Or in a controller:
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ApplicationController extends Controller {
@service flashMessages;
}
Impact considerations
The default option for injectionFactories was ['route', 'controller', 'view', 'component']. So implicit injection was enabled by default, despite being deprecated. It’s likely that some apps will break if they didn’t inject the service correctly and accidentally relied on this feature.
In Ember 4.0, this default injection throws a deprecation warning. Fixing the error requires setting injectionFactories to [], an option that hasn’t been documented in years.
As of Ember 4.0, implicit injection with
application.inject
has been disabled. This PR removes the long-deprecated implicit injection of the flash messages service into all routers, controllers, views, and components.Migration guide
You should inject the service yourself wherever you need it.
For example, in a component:
Or in a controller:
Impact considerations
The default option for
injectionFactories
was['route', 'controller', 'view', 'component']
. So implicit injection was enabled by default, despite being deprecated. It’s likely that some apps will break if they didn’t inject the service correctly and accidentally relied on this feature. In Ember 4.0, this default injection throws a deprecation warning. Fixing the error requires settinginjectionFactories
to[]
, an option that hasn’t been documented in years.