I made a simple example of angular 2. I added item in an array. When user types anything and press the button, it is added into the array and get displayed in the list .
I am facing two issues
- 1 ) how to clear input field after pusing to array ?
2 ) How angular 2 works ? As in document Angular 2 remove watches .So when item is added in array .how template show updated list .how ?
is it watching the model of list ?
Here is my plunker code
<ion-navbar *navbar>
<ion-title>
Ionic 2
</ion-title>
</ion-navbar>
<ion-content class="has-header">
<ion-list style="border:2px solid grey;height:500px">
<ion-item *ngFor="#item of Todo">
{{item.name}}
</ion-item>
</ion-list>
<label class="item item-input">
<span class="input-label" >Add Todo</span>
<input type="text" #todo placeholder="Add todo" >
</label>
</ion-content>
<ion-footer-bar (click)="addItem(todo.value)">
<h1 class="title" style='color:red'>Add Todo!</h1>
</ion-footer-bar>