'Output of the message after sending the request
Please help me. I'm working with a small firm that sends one field to create a new password. If the request is successful, I get the following answer in the browser: network / fetch

Please can you show me an example of how to display a reply message? And if not, how to show a ready-made message if the request is successful? thank you very much
my console
template:
<div class="forgot_password_component">
<form class="forgot_password_form" [formGroup]="forgotPasswordForm">
<mat-form-field appearance="outline">
<mat-label>Type email</mat-label>
<input matInput formControlName="email">
<mat-error *ngIf="forgotPasswordForm.controls['email'].errors?.required">Field can't be empty</mat-error>
<mat-error *ngIf="forgotPasswordForm.controls['email'].errors?.email">Invalid email</mat-error>
</mat-form-field>
<button mat-raised-button color="accent" [disabled]="forgotPasswordForm.invalid" (click)="sendEmailToRestorePassword()">Restore</button>
//Message from browser
<span></span>
//Ready message
<span>A new password has been sent to the specified mail</span>
</form>
</div>
ts code
export class ForgotPasswordComponent implements OnInit {
forgotPasswordForm: FormGroup;
subscription: Subscription;
isLoading = false;
constructor(private formBuilder: FormBuilder, private router: Router, private authService: AuthService) { }
ngOnInit(): void {
this.forgotPasswordForm = this.formBuilder.group({
email: ['', [Validators.required, Validators.email]] })
}
email() {
return this.forgotPasswordForm.get('email')
}
sendEmailToRestorePassword() {
this.subscription = this.authService.forgotPassword(this.forgotPasswordForm.value).subscribe((done) => {
this.isLoading = false;
this.router.navigate(['auth', 'login'])
})
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

