Issue
im trying to call a function but one on mi parameters are in an api, so i need to use an {{}} this is an example of mi code:
<button class="cssbuttons-io-button" (click)='goToPage("Players", {{team.TeamID}} )'> Informacion</button>
i tried this but doesnt work
<button class="cssbuttons-io-button" id = {{team.TeamID}} #teamid (click)='goToPage("Players", $event.target )'> Informacion
Solution
If you have to pass a variable into a function from the html, you do not need interpolations ({{}}). You can just use the variable or API response as a parameter to the method. But you need to declare that variable using public access modifier. Below I have corrected your problem.
<button class="cssbuttons-io-button" id = "{{team.TeamID}}" #teamid (click)="goToPage('Players', team.TeamID )">Informacion</button>
Answered By - thithija Milan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.