K
K
Konstantin2020-10-27 01:59:23
Angular
Konstantin, 2020-10-27 01:59:23

How to improve the component?

The component called ExecutorsListComponent has a load() method that pulls the service inside:

this.executorsService.load(configuratorParameters.params);

Where configuratorParamerers is a class containing and returning all request parameters for loading data.

In the same component, three events are listened for: search, filter, sorting. From each event in subscribe, I receive parameters that are set in configuratirParameters and the second line calls the load () method to unload data with a new configurator, parameters.

As a result, I don’t like that the method is twitching in three subscriptions, can it be called once on any of the events?

Or is it better to hide this implementation by adding a subject to change the configurator and listen to this subject inside the service without exposing the load() call in the component?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question