Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Ionic Input shows [object Object] as placeholder

$
0
0

@miropolis wrote:

Hello Ionic community,

I am very new to the Ionic Framework, Angular JS and TypeScript but trying to improve as fast as possible.
But now I encountered a problem I can’t seem to solve, not even using Google :smile:

So I was just trying a simple Input function.
This is the relevant part of my .html file:

<ion-content padding>
    <ion-item>
        <ion-input type="text" placeholder="Enter token" [(ngModel)]="var1"></ion-input>
     </ion-item>
     <button ion-button block (click)="login()">Login</button>
</ion-content>

And this is the relevant part of my .ts file:

export class StartPage {

  constructor(public navCtrl: NavController, public navParams: NavParams) {
  }

 var1 ={}
  login() {
    console.log(this.var1);
    if(this.var1=="Hallo"){
     doSomething();
    }
  }
  ionViewDidLoad() {
    console.log('ionViewDidLoad LoginPage');
  }
}

So the Input field should show “Enter token” as a placeholder, right?
But when I run ionic lab it just shows “[object Object]”. So why is that?

By the way I regarded the page https://ionicframework.com/docs/developer-resources/forms/ for this, but just wanted to make this feature as simple as possible.

I am grateful for any hints.

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>