相关疑难解决方法(0)

什么是Angular相当于AngularJS $手表?

在AngularJS中,您可以使用$watch函数来指定观察者观察范围变量的变化$scope.在Angular中观察变量(例如,组件变量)的等价物是什么?

angular2-changedetection angular

204
推荐指数
7
解决办法
14万
查看次数

如何在数组上按项目后清除输入字段?

我做了一个角度2的简单例子.我在数组中添加了项目.当用户键入任何内容并按下按钮时,它将被添加到数组中并显示在列表中.

我面临两个问题

  • 1)如何在插入数组后清除输入字段?
  • 2)角度2如何工作?如在文档Angular 2中删除监视.当项目添加到数组.how模板显示更新列表.how?

    是在看列表模型吗?

这是我的plunker代码

<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>
Run Code Online (Sandbox Code Playgroud)

javascript angularjs ionic2 angular2-routing angular

0
推荐指数
1
解决办法
839
查看次数