AngularJS:ClearText无法在Ionic ngClick中使用

时间:2022-09-05 18:52:58

I am trying to clear a text on an ionic modal text field in angularjs and ionic and this is my attempt:

我试图在angularjs和ionic中的离子模态文本字段上清除文本,这是我的尝试:

<label class="item item-input">
              <textarea ng-model="content" rows="5" placeholder="write something"></textarea>
</label>

This is the button to close

这是关闭的按钮

<button style="border: 3px solid red; border-radius:5px; color: #ff6000" class="button button-clear button-positive" ng-click="clearContent(); close()">Close</button>

This is the scope function that clears the text

这是清除文本的范围函数

//clear the content of the text field
    $scope.clearContent = function() {
    $scope.content = '';
};

When I click the close button, nothing happens. Everything seems okay, but don't know what is wrong.

当我单击关闭按钮时,没有任何反应。一切似乎都没问题,但不知道出了什么问题。

1 个解决方案

#1


0  

Please try this :

请试试这个:

HTML

<button style="border: 3px solid red; border-radius:5px; color: #ff6000" class="button button-clear button-positive" ng-click="clearContent()">Close</button>

JS

$scope.clearContent = function() {
    $scope.content = '';
    $scope.close();
};

$scope.close=function(){
    //close will be here
}

#1


0  

Please try this :

请试试这个:

HTML

<button style="border: 3px solid red; border-radius:5px; color: #ff6000" class="button button-clear button-positive" ng-click="clearContent()">Close</button>

JS

$scope.clearContent = function() {
    $scope.content = '';
    $scope.close();
};

$scope.close=function(){
    //close will be here
}