0

Neither

public constructor(private readonly objectEntityService: ObjectEntityService) {}

nor

public constructor(entityServices: EntityServices) { entityServices.getEntityCollectionService("Object"); }

works inside a service. Injecting to a component works fine. The app compiles but I get a blank web page when it's served. Tested on Angular 11.0.6 and 11.2.3.

Edit: Creating a new blank service and injecting to it works. Injecting the entity service to a component and storing it inside the service with the injection issue through a method also works fine even though injecting it directly doesn't.

  • 1
    do you get any errors in the console? – BizzyBob Mar 09 '21 at 07:41
  • None. Just a blank page and a blank console. I managed to create a workaround by injecting the service to a component and then storing it in the other service by calling its method from within the component. It should obviously work without a workaround like that though. – Santeri Haka Mar 09 '21 at 14:35
  • Hi, welcome to StackOverflow! Can you please describe your service class? How does it look like? Why are you using once ObjectEntityService once EntityService? – Janos Vinceller Mar 15 '21 at 09:33
  • It happens in most of the services of the app. For example, trying to inject to a simple NgRx Effects service that sends one HTTP call through another service fails the same way. In fact, trying to inject it directly to the service sending the HTTP call fails as well. – Santeri Haka Mar 17 '21 at 15:11

0 Answers0