Angular 复选框状态仅在下次请求时可用
我有这个模板:Angular 复选框状态仅在下次请求时可用,angular,Angular,我有这个模板: <h2>Sailing profiles</h2> <label *ngFor="let sailingProfile of sailingProfiles"> <input type="checkbox" name="{{sailingProfile.title}}" [(ngModel)]='sailingProfile.checkBoxState' (change)="sendParams()"> {{sail
<h2>Sailing profiles</h2>
<label *ngFor="let sailingProfile of sailingProfiles">
<input type="checkbox" name="{{sailingProfile.title}}" [(ngModel)]='sailingProfile.checkBoxState' (change)="sendParams()">
{{sailingProfile.title}}<br>
</label>
<h2>Counters</h2>
<label *ngFor=" let counter of counters">
{{counter.type}}: <input type="text" [(ngModel)]='counter.value' (blur)="sendParams()"><br>
</label>
(更改)
和(单击)
事件在(ngModelChange)
事件之前处理
改用
<input type="checkbox" name="{{sailingProfile.title}}"
[(ngModel)]='sailingProfile.checkBoxState'
(ngModelChange)="sendParams()">
您使用的Angular2版本是什么?@angular/core:“2.0.0-rc.4”我也尝试过(单击)=“sendParams()”,但结果相同
<input type="checkbox" name="{{sailingProfile.title}}"
[(ngModel)]='sailingProfile.checkBoxState'
(ngModelChange)="sendParams()">