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