Skip to content
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

It is not an issue, but the documentation needs correction. When you inject the service the name in docs is wrong. service:notification-messages should be service:notification-messages-service #182

Closed
GitSahib opened this issue Aug 14, 2017 · 6 comments
Assignees
Labels

Comments

@GitSahib
Copy link

No description provided.

@ynnoj ynnoj added the doc label Aug 18, 2017
@ynnoj ynnoj self-assigned this Aug 18, 2017
@sdhull
Copy link

sdhull commented Nov 16, 2017

Strange... doing notifications: service('notification-messages') worked fine for me

@olenderhub
Copy link

olenderhub commented Dec 21, 2017

That is interesting, because after upgrading to the new ember-cli,

I need replace notification-messages to notification-messages-service, because without it I have error in tests.

Assertion Failed: Attempting to inject an unknown injection: 'service:notification-messages'

this issue is related only in tests. In develop I can normally use this injected service in both names.

Ember CLI: 2.17.1
Ember CLI Qunit 4.2.1

Thanks for information in this issue, it saved a lot of time :)

@jelhan
Copy link

jelhan commented May 12, 2018

I could confirm this behavior. Only notification-messages-service is working in unit tests. I'm not quite sure why notification-messages works at all cause that's not the name of the service exposed.

Nevertheless notification-messages-service is not a good name. Maybe it should be renamed to notifications? In that case we wouldn't have to write notifications: service('notification-messages-services') but only notifications: service().

ember-source: 2.16.2
ember-cli: 2.16.2
ember-cli-qunit: 4.0.2
ember-qunit: 2.2.0

@jelhan
Copy link

jelhan commented May 20, 2018

This is related to #169 and should also be fixed by #171.

@firstsano
Copy link

firstsano commented Nov 14, 2018

Getting problems using both versions of service name. If I inject as:

notifications: service('notification-messages')

I get Attempting to inject an unknown injection error. If I inject as:

notifications: service('notification-messages-service')

then the notifications don't display. So for now, the most reliable way for me is to use an application initializer:

import CliNotifications from 'ember-cli-notifications/services/notification-messages-service';

export function initialize(application) {
    application.register('service:cli-notifications', CliNotifications);
    application.inject('component:notification-container', 'notifications', 'service:cli-notifications');
    application.inject('component:notification-message', 'notifications', 'service:cli-notifications');
}

Later you inject it as service('cli-notifications'). And of course instead of cli-notifications you can use any name you want.
Maybe it helps someone.

@mansona
Copy link
Owner

mansona commented Nov 12, 2019

This whole thing is solved in #251 (comment) 🎉

If anyone here was still having an issue they can try out the new version before it is released 👍 thanks for the report

@mansona mansona closed this as completed Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants