一个简单的todo

<ul *ngFor="let i of arr">
  <li>{{i}}</li>
</ul>
<input [(ngModel)]="a">
<button (click)="add()">add</button>

 a:string="";
  arr:string[]=['apple','pear','orange'];
  constructor() { }
  add():void{
    if(this.a!=""){
      this.arr.push(this.a)
    }else {
      return
    }
  }
posted @ 2017-06-25 05:40  judy201654321  阅读(146)  评论(0编辑  收藏  举报