I use firebase and angular 2+. In my app I have a login page. When I click 'sign in' button, the spinner is loading and after success, it should be false, but it doesn't update. Why?
Template
<div class="sign-in-form-buttons-section">
<div>{{isLoadingInProgress}}</div>
<button
*ngIf="!isLoadingInProgress; else loading"
mat-raised-button
color="primary"
(click)="onSignInClicked()"
>
Sign In
</button>
<ng-template #loading>
<mat-spinner></mat-spinner>
</ng-template>
</div>
Controller
public signInFormGroup: FormGroup;
public isLoadingInProgress: boolean = false;
constructor() {
this.signInFormGroup = new FormGroup({
email: new FormControl(''),
password: new FormControl(''),
});
}
public onSignInClicked(): void {
this.isLoadingInProgress = true;
const signInInfo: SignInInfo = {
email: this.signInFormGroup.value.email,
password: this.signInFormGroup.value.password
};
this.authService.signInWithEmailAndPassword(
signInInfo.email,
signInInfo.password,
)
.then(() => {
this.isLoadingInProgress = false;
})
.catch(error => {
this.snackBarService.showSnackBar(error.message);
this.isLoadingInProgress = false;
});
}