diff --git a/src/app/chpw/chpw.component.ts b/src/app/chpw/chpw.component.ts index 7ac3063..67f651a 100644 --- a/src/app/chpw/chpw.component.ts +++ b/src/app/chpw/chpw.component.ts @@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { FormGroup, FormBuilder, FormControl, Validators } from '@angular/forms' import { CustomValidators } from '../utils/custom-validators'; import { NzMessageService } from 'ng-zorro-antd'; +import { Router, ActivatedRoute } from '@angular/router' import { HttpClientService } from '../services/http-client.service'; @Component({ @@ -17,6 +18,8 @@ export class ChpwComponent implements OnInit { constructor( private formBuilder: FormBuilder, private message: NzMessageService, + private router: Router, + private route: ActivatedRoute, private httpClient: HttpClientService) { } ngOnInit() { @@ -94,6 +97,7 @@ export class ChpwComponent implements OnInit { this.chpwForm.controls[i].markAsUntouched(); this.chpwForm.controls[i].updateValueAndValidity(); } + this.router.navigate(['../app/main'], { relativeTo: this.route }); } else { this.message.error(response.err_msg + ',修改失败!'); } diff --git a/src/app/chpw/chpw.module.ts b/src/app/chpw/chpw.module.ts index 6caa6ca..3608a3b 100644 --- a/src/app/chpw/chpw.module.ts +++ b/src/app/chpw/chpw.module.ts @@ -1,6 +1,6 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; -import { NgZorroAntdModule } from 'ng-zorro-antd'; +import { NgZorroAntdModule, } from 'ng-zorro-antd'; import { FormsModule, ReactiveFormsModule } from '@angular/forms' import { ChpwRoutingModule } from './chpw-routing.module' import { ChpwComponent } from './chpw.component';