TypeError:jit_nodeValue_17(...)不是一个函数

时间:2018-10-22 02:10:19

标签: angular typescript angular-material

这里的主要目的是注册用户,起初它运行良好,但是现在我做了一些更改,在单击按钮时输入电子邮件和密码后,出现此错误: see the error here enter image description here


身份验证服务:

utilizadorCadastrar(value) {
return new Promise<any> ((resolve, reject) => {
  return this.afAuth.auth.createUserWithEmailAndPassword(value.email, value.senha)
  .then(res => {
    resolve(res);
  }, err  => reject(err));
});

}


cliente-cadastrar.component.ts:

export class ClienteRegistrarComponent implements OnInit {

formCadastro: FormGroup;

{...}

ngOnInit() {
   this.iniciarForm();
}

public cadastrar(value) {
   this.auth.utilizadorCadastrar(value)
    .then(res => {
        console.log(res);
    }, err => {
         console.log(err);
    });  }
    { ... }

cliente-registrar.component.html

错误是从此处(单击)“事件”按钮上出现的

 <form class="form-normal" [formGroup]="formCadastro">
<div class="entrar-container">
  <h1 matDialogTitle>Cadastrar-se</h1>
  <mat-dialog-content class="entrar-container">
    <mat-form-field class="input-full-width" color="warn">
      <input type="email" matInput id="email" placeholder="Email" name="email" formControlName="email">
      <mat-error *ngIf="errosForm.email">
        {{errosForm.email}}
      </mat-error>
    </mat-form-field>
    <mat-form-field class="input-full-width" color="warn">
      <input type="password" matInput id="senha" placeholder="Senha" name="senha" formControlName="senha" [type]="hide ? 'password' : 'text'">
      <mat-icon matSuffix (click)="hide = !hide">{{hide ? 'visibility_off' : 'visibility'}}</mat-icon>
      <mat-error *ngIf="errosForm.senha">
        {{errosForm.senha}}  
      </mat-error>
    </mat-form-field>
  </mat-dialog-content>
  <mat-dialog-actions align="end">
    <button type="submit" mat-raised-button color="warn" [disabled]="!formCadastro.valid" (click)="cadastrar(formCadastro.value)">Cadastrar-se</button>
  </mat-dialog-actions>
</div>

1 个答案:

答案 0 :(得分:4)

今天,当我的按钮单击与表单上的另一个元素具有相同的名称时,我收到了相同的错误。重命名后,错误消失了。