pongib
pongib

Reputation: 23

Cannot clear text in input text field in Ionic

I'm new at Ionic and Angular. I try to create a post status like Facebook, my first task is when the user types any text and press the POST button I want the text in the input field to disappear, but it disappears in the first time when this view is a new load.

When I try to type any text in the input field and press the POST button, the text won't disappear but function in the controller was called. Past, I use label tag but when I press the POST button ng-click didn't work so I change label tag to div tag but it work at the first time as I say above and I include cache is false it didn't work too. Here is my Plunker, This issue is in Chat view.

Upvotes: 2

Views: 9063

Answers (1)

Toxus
Toxus

Reputation: 665

The ng-model should be bound to an object and not to an variable.

The means the the declaration of the variable should be something like:

 $scope.input = {
    saySomething : 'Some question'

  };

The input field should then be:

<input type="text" placeholder="Say Something" ng-model="input.saySomething"/>

Upvotes: 13

Related Questions