Solution for : net::ERR_CONNECTION_REFUSED in Angular

net::ERR_CONNECTION_REFUSED : I’d like to access an API server, but the server hasn’t started. Then I got the error : Could I handle this according to the status of the response ? Solution 1 : Solution 2 : If you are using spring for the backend , just add the annotation @crossorigin in your rest controller to […]

En Lire Plus

TypeScript : how to sleep a thread ?

If we need to sleep e thread, we can implements a delay method that returns a Promise object (which represents the eventual completion, or failure, of an asynchronous operation, and its resulting value) and through the setTimeout method (that sets a timer which executes a function or specified piece of code once after the timer expires) resolve […]

En Lire Plus

TypeScript: map an objects collection into a different one

The map() method is helpful to creates a new array with the results of calling a provided function on every element in the calling array. Suppose that we have two classes: And we have an Angular service called ‘myService‘ that through a .getObjects() method returns the following data: If we need to fill a DestinationType array […]

En Lire Plus