Ng model help


#1

Hi!

I’m learning the basic of ionic with a tutorial and on the data-binding chapter, there is this code:

<div class="card">
    <h4>Hi {{name}}</h4>
    <input ng-model="name" type="text" placeholder="Write your name">
</div>

I tried with the tabs project bt when I do ionic serve, I can write some text but the text after Hi is never updated.

I work with ionic 3.18.0

Anyone know why?


#2

I’ve done other few test but I don’t find why it doesn’t work.
Any idea?


#3

In your html file

<ion-item>
	<ion-input id="myInput" [(ngModel)]="name" type="text" placeholder="I'm the input placeholder text."></ion-input>
</ion-item>

In your ts file

public name: string = "";


#4
<ion-input type="text" #box (keyup)="0"></ion-input>
<p>{{box.value}}</p>