I have a registration form on Ionic 3, but I can not validate the password with another ion input.
register.html:
<ion-item class = "log-input">
<ion-label floating>Email</ion-label>
<ion-input type="text" #username></ion-input>
</ion-item>
<ion-item class = "log-input">
<ion-label floating>Senha</ion-label>
<ion-input type="password" #password></ion-input>
</ion-item>
<ion-item class = "log-input">
<ion-label floating>Confirmar</ion-label>
<ion-input type="password" #conf></ion-input>
</ion-item>
Register
register.ts
import { Component,ViewChild} from '@angular/core';
import { IonicPage, NavController, NavParams, AlertController} from 'ionic-angular';
import { AngularFireAuth } from 'angularfire2/auth';
@IonicPage()
@Component({
selector: 'page-register',
templateUrl: 'register.html',
})
export class RegisterPage {
@ViewChild('username') uname;
@ViewChild('password') password;
@ViewChild('password') conf;
constructor(private alertCtrl:AlertController,private fire:AngularFireAuth, public navCtrl: NavController, public navParams: NavParams) {
}
ionViewDidLoad() {
console.log('ionViewDidLoad RegisterPage');
}
alert(message:string){
this.alertCtrl.create({
title: 'Info',
subTitle:message,
buttons: ['OK']
}).present();
}
registerUser(){
this.fire.auth.createUserWithEmailAndPassword(this.uname.value, this.password.value, this.conf.value)
.then(data=>{
console.log("Sucesso",data);
this.alert('Muito bem! Você está registrado.');
})
.catch(error =>{
console.log('Erro',error);
this.alert(error);
})
console.log("Registro com",this.uname.value , this.password.value);
}
}
Well when I call the '' this.conf.value '' in the create user method, it gives an error, '' Expected 2 arguments, but got 3 ''.