Angular 2 Version:rc.1
I am returning a list of names and places in a table using *ngFor and I want to bind the data to the cell that I click on 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);
}
In the console I am getting the following when I click on a cell with "John" as its value:
<td _ngcontent-pof-13="">
John
</td>
Ideally, the console would just log "John" instead of the entire td element.
Or maybe there is an entirely different and better way to do it.
Any ideas?