Import change detector
This commit is contained in:
+5
-4
@@ -1,4 +1,4 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { ChangeDetectorRef, Component } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
@@ -15,7 +15,7 @@ export class ForgotPasswordComponent {
|
||||
errorMsgs: string[] = [];
|
||||
returnURL: string = '/';
|
||||
|
||||
constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title ) {
|
||||
constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, private changeDetector: ChangeDetectorRef ) {
|
||||
this.title.setTitle("Forgot Password | Mistox");
|
||||
this.route.queryParams.subscribe(params => {
|
||||
this.returnURL = params['returnURL'] || '/';
|
||||
@@ -41,11 +41,12 @@ export class ForgotPasswordComponent {
|
||||
next: async (data) => {
|
||||
if (data.trim() == "Success"){
|
||||
this.errorMsgs = ["Reset password send"];
|
||||
this.changeDetector.detectChanges();
|
||||
await this.sleep(3000);
|
||||
this.router.navigate([this.returnURL]);
|
||||
}else{
|
||||
this.errorMsgs = [];
|
||||
this.errorMsgs.push(data);
|
||||
this.errorMsgs = [data];
|
||||
this.changeDetector.detectChanges();
|
||||
}
|
||||
},
|
||||
error: err => {
|
||||
|
||||
+4
-2
@@ -1,4 +1,4 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { ChangeDetectorRef, Component } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
@@ -19,7 +19,7 @@ export class ResetPasswordComponent {
|
||||
|
||||
errorMsgs: string[] = [];
|
||||
|
||||
constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title ) {
|
||||
constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, private changeDetector: ChangeDetectorRef ) {
|
||||
this.title.setTitle("Reset Password | Mistox");
|
||||
this.route.queryParams.subscribe(params => {
|
||||
this.UserName = params['UserName'] || '';
|
||||
@@ -54,10 +54,12 @@ export class ResetPasswordComponent {
|
||||
next: async (data) => {
|
||||
if (data == true){
|
||||
this.errorMsgs = ["Password reset successfully"];
|
||||
this.changeDetector.detectChanges();
|
||||
await this.sleep(3000);
|
||||
this.router.navigate(["/account/login"]);
|
||||
}else{
|
||||
this.errorMsgs = ["An error has ocurred"];
|
||||
this.changeDetector.detectChanges();
|
||||
await this.sleep(3000);
|
||||
this.router.navigate(["/account/sendresetpassword"]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user