Data-binding not working

Hello, I recently started using Ionic to build hybrid apps, however I faced a lot of trouble since there is not much angular 2 info on the web. I could not make two way binding work, can you please check if am doing something wrong?

PS: I also wanted to implement parse, however could not find a proper place to initialize parse, any help on that will be also appreciated. Thanks in advance.

forgot-password.js

import { FormBuilder, Validators} from 'angular2/common';
import {Page, NavController, Alert } from 'ionic/ionic';

/*
  Generated class for the ForgotPasswordPage page.

  See http://ionicframework.com/docs/v2/components/#navigation for more info on
  Ionic pages and navigation.
*/
@
Page({
  templateUrl: 'build/pages/forgot-password/forgot-password.html',
})
export class ForgotPasswordPage {
  constructor(nav: NavController, form: FormBuilder) {
    this.nav = nav;

    this.email = '';

    Parse.initialize("id", "key");


    this.passwordResetForm = form.group({
          email: ["", Validators.required]
    });

    this.checkEmail = function () {
      console.log(this.email);
    }
  }
}

forgot-password.html

<ion-content padding class="forgot-password">
    <ion-list>
      <ion-item>
        <ion-input placeholder="E-posta">
          <input type="text" [(ngModel)]="email">
        </ion-input>
      </ion-item>
    </ion-list>
    <button mblue-light class="full" (click)="checkEmail()" type="">Şifremi Sıfırla</button>
</ion-content>

Is there a reason why you’re using an inside ?

Have you tried:

<ion-input type="text" placeholder="E-posta" [(ngModel)]="email"></ion-input>

I used something similar and it works.

If you’re using ES6 for your class, be sure to access ‘email’ everywhere inside the class as ‘this.email’ and as an aside, your class functions don’t need the word ‘function’. For example:

checkEmail() {
    console.log(this.email);
}
1 Like

Yes, I tried it and figured it out the hard way. Thanks for the reply and for your time.

Selam kardes, sende bu islerle ugrasiyormussun gördüm. Senle irtibata gecelimde, sorularimizda biribirimize yardim ederiz nediyorsun? bana bi email yazarsan sevinirim : emre_file1993@hotmail.de