我有一个table
,其中放置了input
:
<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>
但focusout
事件未被解雇。
这是处理focusout
函数的方法:
focusOutFunction() {
}
有趣的是,当focusout
未置于input
内时table
完美无缺:
<input type="number" (focusout)="focusOutFunction()" />
当我在桌子内部聚焦时,如何触发事件?
答案 0 :(得分:2)
focusout
Here's a working plnkr autofocus
在一张桌子内进行处理,其设置与您的设置类似。另一个关键是包含 <input type="number" [(ngModel)]="person.CarCount"
(focusout)="focusOutFunction()" autofocus/>
属性:
location / {
if ($arg_sharing)
{
return 301 /social-sharing;
}
location ~ .*/sharing/?.* {
return 301 /social-sharing;
}
}
答案 1 :(得分:1)
使用blur
事件来获得焦点。
<input type="number" [(ngModel)]="person.CarCount"
(blur)="focusOutFunction()"/>