2

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.

1 Answer 1

13

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"/>
Sign up to request clarification or add additional context in comments.

3 Comments

Wow, it work like magic. Thank you very much for saving my life. By the way, Does issue is about primitive and non-primitive or just Ionic mechanism?
The issue is not ionic specific. It's Angular. (Can you mark my awnser as the one that resolved is:) )
Life status : saved, props to you Toxus

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.