After just starting to work with Angular, I am attempting to extract a value from a button displayed in the HTML using a function.
`<button class="btn" id="btn-gold" (click)="value(9)"
name="mybutton" value="9">`
9
I have also included the function call in the HTML file as follows: {{ value() }}.
This is my implementation in the .ts file:
public value(a) {
console.log(a);
return a;
}
Unfortunately, despite seeing the number in the console, I am unable to display any values in my HTML file. The console shows:
- 7
- scoring.component.ts:18 undefined
- scoring.component.ts:18 undefined
Now, my question is why can I not see the value in my .html file when it appears in the console? Additionally, why do I receive two undefined values per click?
Cheers, ArcherMark