Using Angular, I have a function being called on click and I’m passing someValue to it.
Example:
<button (click)="callFoo(bar)">Click Me!</button>
Now, my TS code is something like this:
callFoo(gotInput){
console.log("Print: ", this.someFormGroup.controls.gotInput.value)
}
I’m unable to provide the value fetched to the console.log statement because it says ‘Value is declared but its value is never read’.
How do I go about this?
2
Answers
This should work
Your error is because you’re using
gotInput
wrongly. To fix:Instead of
this.someFormGroup.controls.gotInput.value
, use: