Younes Yaas
Younes Yaas

Reputation: 498

AngularJS - Textarea doesn't want clear after ng-click

I have problem with my textarea.

When I want clear her with ng-click, nothing happens ...

Can you help me ?

This is my code, you can test with Jsfiddle : My app

If you prefer see it here :

HTML :

<div ng-controller="Ctrl1">
        <div><textarea id="yourid" ng-model="isWriting" ng-change="writeEvent(isWriting)"></textarea>
        <span ng-if="displaySend == 1">Yann says :</span> {{isWriting}}
      <p ng-click="sendYaah(isWriting); isWriting == ''">YAH!</p>
</div>

JS :

$scope.writeEvent = function(isWriting) {

  $scope.imWriting = isWriting;
  var empty = "";

  if ($scope.imWriting != empty){
    $scope.displaySend = 1;
    // $scope.waitResponse = true;
  } else {
    $scope.displaySend = 0;
    // $scope.waitResponse = false;
  }

}

Thank for help !

Upvotes: 1

Views: 407

Answers (1)

Pankaj Parkar
Pankaj Parkar

Reputation: 136144

Change ==(equality operator) to =(assignment operator) in ng-click

isWriting == ''

to

isWriting = ''

Forked Fiddle

Upvotes: 2

Related Questions