How do I add an animation while loading a request from Angular 4?

0

My service looks like this:

export class ServicoService {

    constructor(private http:Http) { }

    public listar() {
        return this.http.get('aqui a url')
        .toPromise()
        .then(response => response.json());
    }

}

The code is working correctly, but I would like to give Feedback to the user saying that the content is loading. How do I?

    
asked by anonymous 30.09.2017 / 20:02

1 answer

0

You can extend the Angular Http service to intercept your asynchronous calls by displaying the user a load screen or wait for example.

You can find an implementation in this gist

    
01.10.2017 / 05:23