Fix HTML error with angular foreach

This commit is contained in:
2025-06-25 20:40:28 -07:00
parent 3a8a058689
commit 4ddcf88192
6 changed files with 15 additions and 30 deletions
@@ -15,7 +15,7 @@
</div>
</div>
<ul *ngFor="let msg of errorMsgs" >
<li>{{ msg }}</li>
<ul *ngIf="errorMsgs.length > 0" >
<li *ngFor="let msg of errorMsgs" >{{ msg }}</li>
</ul>
</form>
@@ -15,17 +15,13 @@ export class ForgotPasswordComponent {
errorMsgs: string[] = [];
returnURL: string = '/';
constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, private changeDetector: ChangeDetectorRef ) {
constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title) {
this.title.setTitle("Forgot Password | Mistox");
this.route.queryParams.subscribe(params => {
this.returnURL = params['returnURL'] || '/';
});
}
sleep(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms));
}
onSubmit() {
// Clear errors
this.errorMsgs = [];
@@ -38,15 +34,12 @@ export class ForgotPasswordComponent {
'Content-Type': 'application/x-www-form-urlencoded'
});
this.http.post<string>( "https://mistox.com/api/account/sendresetpassword", body, { headers } ).subscribe({
next: async (data) => {
next: (data) => {
if (data.trim() == "Success"){
this.errorMsgs = ["Reset password send"];
this.changeDetector.detectChanges();
await this.sleep(3000);
this.router.navigate([this.returnURL]);
setTimeout(() => { this.router.navigate([this.returnURL]); }, 3000);
}else{
this.errorMsgs = [data];
this.changeDetector.detectChanges();
}
},
error: err => {
@@ -27,7 +27,7 @@
</div>
</div>
<ul *ngFor="let msg of errorMsgs" >
<li>{{ msg }}</li>
<ul *ngIf="errorMsgs.length > 0" >
<li *ngFor="let msg of errorMsgs" >{{ msg }}</li>
</ul>
</form>
@@ -27,7 +27,7 @@
</div>
</div>
<ul *ngFor="let msg of errorMsgs" >
<li>{{ msg }}</li>
<ul *ngIf="errorMsgs.length > 0" >
<li *ngFor="let msg of errorMsgs" >{{ msg }}</li>
</ul>
</form>
@@ -21,7 +21,7 @@
</div>
</div>
<ul *ngFor="let msg of errorMsgs" >
<li>{{ msg }}</li>
<ul *ngIf="errorMsgs.length > 0" >
<li *ngFor="let msg of errorMsgs" >{{ msg }}</li>
</ul>
</form>
@@ -19,7 +19,7 @@ export class ResetPasswordComponent {
errorMsgs: string[] = [];
constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, private changeDetector: ChangeDetectorRef ) {
constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title ) {
this.title.setTitle("Reset Password | Mistox");
this.route.queryParams.subscribe(params => {
this.UserName = params['UserName'] || '';
@@ -27,10 +27,6 @@ export class ResetPasswordComponent {
});
}
sleep(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms));
}
onSubmit() {
if (this.Password != this.PassworR){
@@ -51,17 +47,13 @@ export class ResetPasswordComponent {
'Content-Type': 'application/x-www-form-urlencoded'
});
this.http.post<boolean>( "https://mistox.com/api/account/resetpassword", body, { headers } ).subscribe({
next: async (data) => {
next: (data) => {
if (data == true){
this.errorMsgs = ["Password reset successfully"];
this.changeDetector.detectChanges();
await this.sleep(3000);
this.router.navigate(["/account/login"]);
setTimeout(() => { this.router.navigate(["/account/login"]); }, 3000);
}else{
this.errorMsgs = ["An error has ocurred"];
this.changeDetector.detectChanges();
await this.sleep(3000);
this.router.navigate(["/account/sendresetpassword"]);
setTimeout(() => { this.router.navigate(["/account/sendresetpassword"]); }, 3000);
}
},
error: err => {