Manipulate data in Ionic 2

1

I'm using Ionic 2 for developing an application, I'd like to know how I can use values sent from a form within a method.

I have the following form:

<form [formGroup]="updateUser" (ngSubmit)="UpdateUser(displayname, email)" #upForm="ngForm">
<ion-list>
  <ion-item>
    <ion-label floating>Nome</ion-label>
    <ion-input type="text"  name="displayname" formControlName="displayname"></ion-input>
  </ion-item>
  <ion-item>
    <ion-label floating>E-mail</ion-label>
    <ion-input type="text" name="email"  formControlName="email"></ion-input>
  </ion-item>
</ion-list>
<button ion-button block [disabled]="updateUser.invalid">Atualizar Dados</button>

And the following method inside my profile.ts:

import { Component } from '@angular/core';
import { NavController, NavParams, LoadingController } from 'ionic-angular';
import { Validators, FormBuilder } from '@angular/forms';
import { AuthProvider } from '../../providers/auth';
import * as firebase from 'firebase';

@Component({
  selector: 'page-perfil',
  templateUrl: 'perfil.html'
})

export class PerfilPage {
  perfis: any;
  updateUser: any = {};

  constructor(public formBuilder: FormBuilder, public navCtrl: NavController, public navParams: NavParams, private auth: AuthProvider, private loadingCtrl: LoadingController) {
auth.getUserData().then(data =>{
  this.perfis = data;
  this.perfis = Array.of(this.perfis);
})
this.updateUser = this.formBuilder.group({
  displayname: ['', Validators.required],
  email: ['', Validators.required]
})
  }

UpdateUser(){
  console.log(this.updateUser.value);
}

  }

I need to get the Display Name and Email values inside this method, so I can only see in the console, and I need to use the values inside the

    
asked by anonymous 21.05.2017 / 22:38

0 answers