K
K
Konstantin2020-04-25 17:43:40
Angular
Konstantin, 2020-04-25 17:43:40

How not to make several identical requests to the server at the routing level?

I have a component called through the route that in ngOninit makes a request to the server. If you switch routing many times, then requests are sent to the server again. How to avoid it?

Tried like this - but it doesn't work:

this.route.paramMap
      .pipe(switchMap((parameters) => of(parameters)))
      .subscribe((params: Params) => {
});

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