MrFlyingToasterman
MrFlyingToasterman

Reputation: 227

How can to read the content of an ion input element?

I have already tested this:

this.changedValue = document.getElementById("processID");
this.changedValueString = this.changedValue.value;
console.log("[INFO] Choosen processID: >" + this.changedValueString + "<");

Unfortunately, I get this with logcat:

[INFO:CONSOLE(56878)] "[INFO] Choosen processID: >undefined<"

Upvotes: 0

Views: 27

Answers (1)

Gowtham
Gowtham

Reputation: 3233

use [(ngModel)] in your input element like this,

<input type="text" [(ngModel)]="inputValue" />

and in your component.ts,

export class Page{
inputValue:string;
  constructor(){
    console.log(this.inputValue)
  }
}

Upvotes: 1

Related Questions