Monday, 15 May 2017

pass the value attribute into (click) attribute within HTML tag

I have the following HTML template:

<form #topping (change)="updateTopping(topping)">
    <span *ngFor= "let top of toppingOptions">
         
        
        <button type="button" value="-add" (click)="addTopping()">+</button>
        <button type="button" value="-minus" (click)="minusTopping()">-</button>
        <br>
    </span>    
</form>

As you can probably tell the error occurs in the Button tag. I want to pass "top.name" into addTopping() and minusTopping(), but don't know the correct way of doing so.

Thanks in advance.



via noobcoder

No comments:

Post a Comment