From 7117bbfdccd8b63bfc99bb926d5ff5efed666d20 Mon Sep 17 00:00:00 2001 From: Jacob Date: Thu, 26 May 2022 15:39:31 -0500 Subject: [PATCH] docs: do not recommend implicit injection Closes #311 --- tests/dummy/app/templates/application.hbs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/tests/dummy/app/templates/application.hbs b/tests/dummy/app/templates/application.hbs index f34d706e..702be13c 100644 --- a/tests/dummy/app/templates/application.hbs +++ b/tests/dummy/app/templates/application.hbs @@ -38,19 +38,7 @@ export default Controller.extend({ notifications: service(), }); -

Or inject it everywhere with an initializer.

-// app/initializers/inject-notifications.js -export function initialize(application) { - ['controller', 'component', 'route'].forEach(injectionTarget => { - application.inject(injectionTarget, 'notifications', 'notification-messages:service'); - }); -}; - -export default { - name: 'inject-notifications', - initialize -}; - +

Prior to Ember 4.0.0 it was also possible to inject it everywhere with an initializer. However, this has been deprecated and will no longer work in Ember 4.0.0 or later.

There are four styles of notification available.

Default value is info

@@ -275,4 +263,4 @@ export default NotificationsService.extend({

© Chris Manson 2019

- \ No newline at end of file +