This question is related to another question that I asked recently at the 
forum. I had to start a new post because my question evolved over time and 
my original question wasn't valid any more. I narrowed down my problem to 
the quantity buttons submitting every time they're clicked so I am only 
showing my quantity button code. What I want to find out is how can I get 
the buttons to only submit when the submit button is clicked. Right now 
they console log 'click submitted' every time they are clicked.

The HTML

<button class="minus-btn" (click)="minus(product)" type="button" name="btn" 
onclick="return false;">
<img src="../assets/images/minus.svg" alt="minus" /></button>
<input class="num" name="int" [value]="product.nullValue" formControlName=
"int" ng-minlength="0" type="number" required />
<button class="plus-btn" (click)="plus($event, product)" name="btn" type=
"button" onclick="return false;">
<img src="../assets/images/plus.svg" alt="plus" /></button>




and in the controller:

plus($event, product:any) {
  $event.preventDefault();
  product.nullValue++;
  this.quantity = product.nullValue;
  console.log('click submitted');
  return false;  
  return this.quantity;
 
}


minus(product:any){ 
 product.nullValue--;
  this.quantity = product.nullValue;
  console.log('click submitted'); 
  return false;
  return this.quantity;


}



-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/angular/ba07e434-f9b3-4950-a254-fa58e628d967o%40googlegroups.com.

Reply via email to