Replies: 1 comment 1 reply
-
Hey, If you need to access the service directly in the constructor, you should use constructor-injection instead of field-injection. Fields will be injected after the constructor is invoked, so they won't exist inside of the constructor. Constructor injection looks like this: constructor(@inject(DataMonitorService) protected dataService: DataMonitorService){
// ... Constructor code that accesses dataService...
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,



I create a custom data service, I want to inject it into my custom node view. I find the service is always undefined in the node view, I debug and find the node view is constructed first and then construct my data service.
is it possible to create my custom service for node view? and where is the proper place for my data service, I want to invoke the stop method in service when the file is closed.
Beta Was this translation helpful? Give feedback.
All reactions