Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get value of <ion-input> in ionic framework? [duplicate]

I want value of following input elements so what I should do?

  <ion-item>
    <ion-label floating>Username</ion-label>
    <ion-input type="text" ></ion-input>
  </ion-item>

  <ion-item>
    <ion-label floating>Password</ion-label>
    <ion-input type="password" ></ion-input>
  </ion-item>
</ion-list>
like image 881
lalit jadhav Avatar asked Dec 14 '16 11:12

lalit jadhav


1 Answers

well i know a little bit about ionic 2....so what i suggest you to use ng model for inputs like below

<ion-item>
    <ion-label floating>Username</ion-label>
    <ion-input type="text" [(ngModel)]="username"></ion-input>
  </ion-item>

  <ion-item>
    <ion-label floating>Password</ion-label>
    <ion-input type="password" [(ngModel)]="password"></ion-input>
  </ion-item>
</ion-list>

for ionic one its ng-model

for ionic two its [(ngModel)]

Hope this will help you a little bit

update

https://ionicframework.com/docs/v2/resources/forms/

see the above link..in this they used this.todo inside logform function....i am clear about this but i dont know what is that export class bla bla.....

export class FormsPage {
  todo = {}
  logForm() {
    console.log(this.todo)
  }
}
like image 124
Sa E Chowdary Avatar answered Sep 23 '22 02:09

Sa E Chowdary