How to create a field dynamically in Ionic and/or Angularjs?

Asked

Viewed 305 times

0

Have a list of products, but my list does not have the quantity field, and nor should have because it would be stock control and that is not it.

I want the quantity field so when you click (+) add 1 and click (-) decrease 1.

I try to create the quantity field in the controller this way:

$scope.user.bebidasextras.quantidade=0;

And in View this way:

<i class='icon ion-plus-round icon-plus-round' mouse-down-up ng-click='addProduct(product)'></i>
                             <span class='product-quantity'>{{bebida.quantidade}}</span>
<i class='icon ion-minus-round icon-minus-round' mouse-down-up ng-click='removeProduct(product)'></i>

But even the zero value (0) does not appear in my view so that the user understands that the item is reset.

How to create this field, which will be saved later?

  • I need to see more of the code to be able to help. In Scope you always have 1 product alone or is it an array? In the view that part of the code is inside an ng-repeat?

  • In your Scope you put $scope.user.bebidasextras.quantidade and in your view you should put {{user.bebidasextras.quantidade}}.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.