2017-09-27 13 views
0

私はinoutフィールドを持っています。私はSendフィールドをクリックしてクリアしたいのですが、それはどのようにイオンタイプのテキストスクリプトで行うのですか?ionic v3の入力フィールドをtypescriptでクリアする方法

これは、これは

私のTSファイルである私のコード

>

<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> 

です

send(){ 

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


    }); 

答えて

0

こんにちは、このことができますでしょうか?

send(){ 
    this.ref.push({ 
     //key:this.ref.push().key("hello"), 
     name: this.name, 
     message: this.newmessage, 
     phNo: this.data3, 
    }); 
    this.newmessage = ""; //clear this.newmessage 
    } 
+0

はい、これは助け –

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

+0

おかげでとにかく、typescriptですと角度4で作業し、これは役立ちません:) –

関連する問題