私のコードは次のとおりです。
password-change.ts
import { Component, OnInit } from '@angular/core';
import { REACTIVE_FORM_DIRECTIVES, FormGroup, FormBuilder, Validators } from '@angular/forms';
import { Meteor } from 'meteor/meteor';
import { MeteorComponent } from 'angular2-meteor';
import { Router , ROUTER_DIRECTIVES} from '@angular/router';
import { MdCheckbox } from '@angular2-material/checkbox';
import { MD_INPUT_DIRECTIVES } from '@angular2-material/input';
import { MD_BUTTON_DIRECTIVES } from '@angular2-material/button';
import { Accounts } from 'meteor/accounts-base';
import { MD_TOOLBAR_DIRECTIVES } from '@angular2-material/toolbar';
import template from './password-change.component.html';
@Component({
selector: 'password-change',
template,
directives: [REACTIVE_FORM_DIRECTIVES, MdCheckbox, MD_INPUT_DIRECTIVES, MD_BUTTON_DIRECTIVES,MD_TOOLBAR_DIRECTIVES]
})
export class PasswordChangeComponent extends MeteorComponent implements OnInit {
passwordForm: FormGroup;
error: string;
constructor(
private router: Router,
private formBuilder: FormBuilder
) {
super();
}
ngOnInit() {
this.passwordForm = this.formBuilder.group({
oldPassword: ['',Validators.required],
newPassword: ['', Validators.required],
});
this.error = '';
}
ChangePassword() {
if (this.passwordForm.valid) {
Accounts.changePassword({oldPassword:this.passwordForm.value.oldPassword,newPassowrd:this.passwordForm.value.newPassword,}
), (err) => {
if (err) {
this.error = err;
} else {
this.router.navigate(['/party']);
}
};
}
}
}
指定されたパラメーターが呼び出しターゲットと一致しないというエラーがあります。入力が oldPassword:any ではなく、oldPassword:string を要求しています。
どうすれば修正できますか?