0

I'm using Ionic framework to create my app.

I have a text input, with ng-model="answer", and bellow a have a button that starts speech recognition and then replaces the input text with the spoken one.

The problem is that I can't change the input's text programmatically when using the mic with $scope.answer="any text", it looks like it just doesn't change the view's value.

I found that I have to use a directive in order to bind the model, but to be honest I don't know how to address it right now.
Also I've tried $scope.$apply() but it works only the first time and when I haven't wrote any test directly to the input yet.

1
  • Can you include the code that changes the $scope.answer programmatically? Commented Jan 13, 2016 at 9:53

1 Answer 1

1

What you are looking for may be Angulars $watch() function, so you can handle any model changes even outside of the input field.

https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$watch

Sign up to request clarification or add additional context in comments.

Comments

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.