So I have the following:
<div *ngFor="let career of careers">
<label>{{career.name}}</label>
<input type="checkbox" attr.id="{{career.id}}" (change)="doSomethingWithId($event.target)"
</div>
The TS Component:
doSomethingWithId(target: Element): void {
console.log(target.attributes.id);
}
The id here gives an error:
Property 'id' does not exist on type 'NamedNodeMap'.
I don't know if attr.id is the best way even or if it should just be id, or even data-id. But I need to get the career.id of what was clicked on.