一个简单的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
    }
  }
You can change the world with your heart,even a lot of changes sometimes unless you won't geiv up....
原文地址:https://www.cnblogs.com/xiongwei2017/p/7076030.html