K
K
Konstantin2020-06-25 09:30:24
Angular
Konstantin, 2020-06-25 09:30:24

Do you want to continue with the request?

There is a service which contains two methods: get() и filter(). Both execute the request and return data from the north.

The first method is called in the default component. - the data is received and given to the pagination service.

When the user selects values ​​from the filter and presses the Filter button, the data is received by calling the filter() method from the service. After all the same. Except - that when navigating through the page - the first get() method is called.

How to continue calling the last method?

The function that is called when going to the next page:

public getPage(page: number): void {
        this.paginationService.calculateOffsetLimit(page);
        this.paginationService.updateCurerntPage(page);
        this.applicationService.get(this.paginationService.getOffset(), this.paginationService.getLimit());
    }


Is it worth it to make a mess in this function and add an if with a check whether the filter is selected or not in order to call the filter () method from the service?

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