Skip to content

Update importing-inject-from-ember-service to have guidance for library authors that need to support ember prior to 4.1 #1399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions content/ember/v6/importing-inject-from-ember-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,10 @@ export default class MyRoute extends Route {
```

You can use the [ember-codemod-remove-inject-as-service](https://github.com/ijlee2/ember-codemod-remove-inject-as-service) codemod, to fix all violations.

If you're working on a library that needs to support ember-source prior to 4.1, you can support both styles of `service` via:
```js
import * as emberService from '@ember/service';

const service = emberService.service ?? emberService.inject;
```