1
I have a synchronous call new SyncRequestClient().post<HistoricoModel,Response>(solrRequest, request);
and I need a spinner created for that call. Appear before the call is made and disappear after the call using the Angularmaterial component <mat-progress-spinner>
or <mat-spinner>
, but it doesn’t work, the spinner never appears.
html code:
<mat-spinner *ngIf="spinnerVisible"></mat-spinner>
Component.
public spinnerVisible: boolean = false;
public sendGetDocumentosAllPages(pesquisa, tipo) {
this.spinnerVisible = true;
response = new SyncRequestClient().get<Response>(solrRequest);
this.spinnerVisible = false;
return response;
}
Query takes time to execute, but spinner never appears
That code of yours is completely synchronous
– Eduardo Vargas
Yes, so it is not possible to add a spinner. Or is there a way? I think it doesn’t work because it can only one action at a time, that’s it ?
– Renato Carauta Ribeiro
it doesn’t work because this synchronous code is practically instaneo , to work you have to turn into asincrono to wait for the call
– Eduardo Vargas