1
<td>{{count}}</td>
<td><div class="col-xs-12"><input type="text" ng-keypress="count ='10'" ng-init="count=0"></div></td>

Its working but I want to put the input text value into the count= to display the input value in the {{count}} So if I write 20 into the input box the {{count}} must be 20 etc. But I dont know how to put the input text value into the ng-keypress without adding extra javascript parts.

1
  • do u want the value in the input box to get incremented to count or just show the exact same value? Commented Nov 20, 2016 at 23:00

1 Answer 1

1

Put ng-model directive on input element, That will enable two way binding and remove ng-keypress which isn't make sense there to have it.

<td>
  <div class="col-xs-12">
     <input type="text" ng-model="count" ng-init="count=0">
  </div>
</td>
Sign up to request clarification or add additional context in comments.

2 Comments

Yes, I tried, but when I put in it nothing happens. I am testing w3schools.com/angular/tryit.asp?filename=try_ng_ng-keydown here.
Thanks I missed a " from the row and thats why not worked.

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.