K
K
Konstantin2020-09-29 20:25:17
Angular
Konstantin, 2020-09-29 20:25:17

How to push changes in the service to the factory?

As you know, Angular creates modules once and does not decrease them.

In my case, the module uses a factory that has dependencies:

useFactory: (httpClient: HttpClient, customBlockService: CustomBlockService, EsService: EsService) => {
}


The problem is that if the module has already been created once, then the second time it is not created, but the ready one is used. Therefore, those changes that occur in dependent services EsService: EsServicehave no effect on the second call to the module (reuse).

How to make it so - so that the factory will update the module - if there were changes in dependent services?

I believe - the difficulties arose because of the wrong architecture.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
acwartz, 2020-09-30
@Junart1

The problem is that if the module has already been created once, then the second time it is not created, but the ready one is used.

Well, specify providedIn: any instead of root, then modulo each....

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question