import { Component } from '@angular/core' ; import { NgForm } from '@angular/forms' ; import { NavController } from 'ionic-angular' ; import { LoginPage } from '../login/login' ; import { UserService } from '../../providers/user-service' ; import { Auth , User , UserDetails , IDetailedError } from '@ionic/cloud-angular' ; @ Component ( { selector : 'page-user' , templateUrl : 'signup.html' } ) export class SignupPage { signup : { name ? : string ; email ? : string ; password ? : string ; } = { } ; details : UserDetails = { "name" : this . signup . name , "email" : this . signup . email , "password" : this . signup . password } ; submitted = false ; constructor ( public navCtrl , public userService , public user , public auth ) { } onSignup ( form ) { this . submitted = true ; if ( form . valid ) { console . log ( this . signup ) ; this . auth . signup ( this . signup ) . then ( ( ) => { this . navCtrl . push ( LoginPage ) ; } , ( err ) => { for ( let e of err . details ) { if ( e === 'conflict_email' ) { alert ( 'Email already exists.' ) ; } else { } } } ) ; } } forgetPassword ( ) { } }