0
votes

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

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

0
votes

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
}