@Hi AlleAmiDev sorry, but maybe I wasn't enough clear about it.
You are right, using @Inject() it's not a desired way to inject services into your components, but that was just an example.
@Inject()
You should use @Inject('value') when you need to inject just a specific value and not a whole instance.
@Inject('value')
For ex:
providers: [ { provide: "language", useValue: "en" } ],
and then in your components:
... @Inject("language") private language, ....
Did I answer your question? :-)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
@Hi AlleAmiDev sorry, but maybe I wasn't enough clear about it.
You are right, using
@Inject()
it's not a desired way to inject services into your components, but that was just an example.You should use
@Inject('value')
when you need to inject just a specific value and not a whole instance.For ex:
and then in your components:
Did I answer your question? :-)