ng-model is not updating in Angularjs -


acutally learning angularjs. i've introduced problem when click ng-click, ng-model not updating. code follows,

<div ng-repeat="product in cart">      <input type="number" ng-model="product.quantity" ng-required class="input-sm">      <button class="btn btn-xs" type="button" ng-click="product.quantity++">+</button>      <button class="btn btn-xs" type="button" ng-click="product.quantity--">-</button>  </div>

try this

<button type="button" ng-click="product.quantity = product.quantity+1">+</button> <button type="button" ng-click="product.quantity = product.quantity -1">-</button> 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -