I have a table
where input
is placed:
<tr *ngFor="let persons of ReceivedData">
<td *ngFor="let person of persons">
<div *ngIf="person.personId === editRowId && person.editable === true ">
<input type="number" [(ngModel)]="person.CarCount"
(focusout)="focusOutFunction()"/>
</div>
<div *ngIf="person.editable === false " (click)="toggle(person)">
{{ person.CarCount ? person.CarCount : '-' }}
</div>
</td>
<tr>
But the focusout
event isn't fired.
Here's the method handling the focusout
function:
focusOutFunction() {
}
Interestingly focusout
works perfectly when input
is not placed inside table
:
<input type="number" (focusout)="focusOutFunction()" />
How can I fire an event when I focus inside of the table?
Here's a working plnkr of
focusout
proc'ing inside a table with a similar setup as you have. The other key is to include anautofocus
attribute: