I've been using them NgxSpinner in my projects recently, and I've been facing this strange behaviour on the spinner.hide(). I want to make this function happen in the subscribe complete function, because you know? Thats the perfect spot for it... The spinner will only hide when there's any kind of response from the API...
Example of what I'm talking about:
this.spinner.show();
this.authService.login(this.formLogin.value).subscribe({
next: (token) => {
console.log(token);
StorageUtil.login(token.token, token.refreshToken);
},
error: (error) => this.showError(),
complete: () => {
console.log('Bateu here');
this.spinner.hide();
},
});
But everytime I try to do so, the spinner opens, but it never closes... I know about the setTimeout function... but thats totally nonsense right?
setTimeout(() => {
this.spinner.hide();
}, 2000);
Am I doing something wrong...
I use this in my project and it work well