#Service injection error in standard components
38 messages · Page 1 of 1 (latest)
@Injectable({providedIn: 'root'})
export class LogUpdateService {
then in the component either logupdateservice = inject(LogUpdateService)
or
constructor(private logupdateservice: LogUpdateService) {}
Yes, I have the root provider in all the services but I don't know what happens that it doesn't take it
And the services that belong to library modules have the module imported
It should work. maybe clear the cache and restart the dev server. I think it is in .angular/cache
It looks like the service has a bunch of injected services as well. You could be running into a situation where the service hasn't been created yet.
Ok, I'll try it although the project was created recently, I was very surprised
Well, that hasn't been resolved... I still have the same problem.
is one of the services overridden by {provide: myservice, useclass: somethingelse} or anything like that? If one of the nested services isn't provided properly the error may not be clear.
no, none... I don't know if it has to do with how the lazy components are being imported
I'll go over some basics. There is a root injector context, then each lazy feature creates an injection context. A service provided in a route provider or component is available to it's children. Something providedin:root that is lazy loaded won't be available in the root context until loaded, ie. a service used in that lazy loaded context, but nowhere else.
What is the service, what does it inject, and how is it used?
the nzModalService is what?
is the Servide on a library og ngxorro
but I have the imported module
where are you importing the module?
that doesn't seem to apply
that is to modify default values, I don't need to add that
and what it asks me for is Utils service and it is in root mode
is the error when you open a dialog?
Homecomponent
it isn't in the homecomponent constructor
how and where is it used?
provide and inject are two different things. providedIn, or in the providers array inserts it in the injection context. inject() or constructor(private myservice: MyService) injects it in a component so you can access it.
the strange thing in HomeComponent I don't use it