Angular 2 Version:rc.1
I have a table displaying names and places using *ngFor, and I need to bind the clicked cell's data to a variable in my component.
component.html
<tr *ngFor="let result of Results$">
<td #foo (click)="passValue(foo)">
{{result?.name}}
</td>
<td>
{{result?.place}}
</td>
</tr>
component.ts
passValue(foo) {
this.value = foo;
console.log(foo);
}
When I click on a cell with "John" as its value, the console displays:
<td _ngcontent-pof-13="">
John
</td>
Is there a way to only log "John" instead of the entire td element?
If you have any suggestions or better solutions, please share!