Two text fields are synchronized with two ng-model directives:
A Pen by Matt Rependa on CodePen.
| <div ng-app="" ng-init="quantity=1;price=5"> | |
| <p> | |
| <label for="quantity">Quantity:</label> | |
| <input type="number" ng-model="quantity" id="quantity"> | |
| </p> | |
| <p> | |
| <label for="costs">Costs:</label> | |
| <input type="number" ng-model="price" id="price"> | |
| </p> | |
| <p>Total in dollar: {{ quantity * price }}</p> | |
| </div> |
Two text fields are synchronized with two ng-model directives:
A Pen by Matt Rependa on CodePen.
| <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.14/angular.min.js"></script> |