如何使用打字稿清除离子v3中的输入字段

时间:2017-09-27 05:19:36

标签: typescript ionic-framework

所以,我有一个inout字段,当我点击Send时我想清除文本字段,我不知道如何在离合器的typescript中做到这一点。

这是我的代码:

 <ion-footer>
    <ion-item>
        <ion-input id="testId" type="text" placeholder="Type your Message here..." [(ngModel)]="newmessage"></ion-input>
        <button ion-button clear item-right (click)="send()">Send</button>
    </ion-item>
</ion-footer>

这是我的Ts档

 send(){

    this.ref.push({
        //key:this.ref.push().key("hello"),
        name: this.name,
        message: this.newmessage,
        phNo: this.data3,


    });

2 个答案:

答案 0 :(得分:2)

  

嗨,这有帮助吗?

//p[@class='fontlarg'][1]/b[1]

答案 1 :(得分:0)

检查这个

 <ion-view title="Standard">
  <ion-content class="has-header" ng-controller="calcCtrl">
    <form id="calcForm" name="calcForm" ng-submit="submitData(calculate)">
      <label class="item-input">
        <span class="input-label">Price</span>
        <input class="input-label" type="text" placeholder="$0.00" ng-model="calculate.price">
      </label>

      <label class="item-input ">
        <span class="input-label">Discount</span>
        <input class="input-label" type="text" placeholder="$0.00" ng-model="calculate.discount">
      </label>
    </form>
  </ion-content>

  <ion-footer-bar class="bar-stable">
    <div class="buttons pull-right">
      <button class="button button-positive" ng-click="resetForm()">Clear</a>
    </div>
  </ion-footer-bar>
</ion-view>






  $scope.clearFields = function() {
$scope.calculate = angular.copy(calcForm);
$scope.calcForm.$setPristine();
}

Check this