import { Component, OnInit } from '@angular/core'; import { HttpClient } from '@angular/common/http' import { MatDialogRef } from '@angular/material/dialog'; import { NzMessageService } from 'ng-zorro-antd/message'; @Component({ selector: 'app-changepassword', templateUrl: './changepassword.component.html', styleUrls: ['./changepassword.component.scss'] }) export class ChangepasswordComponent implements OnInit { constructor(private http: HttpClient, public dialogRef: MatDialogRef, private message: NzMessageService) { } ngOnInit() { } errmsg: string = '' onSubmit(e) { this.http.put( '/api/CompanyAccount/Password', { newPassword: e.newPassword, password: e.password } ).subscribe(data => { this.dialogRef.close(data); this.message.create('success', `密码修改成功`); }, (err) => { this.errmsg = err } ) } }