这是我的代码:
HTML:
<div *ngFor="let reject of rejects, let i = index">
<h2>{{reject.reason}}</h2>
<input type="text" [(ngModel)]="reject.reason" [ngFormControl]="inputField">
<rt-dropdown (selectedReason)="selectReason($event.value, i)"></rt-dropdown>
</div>
和我的主要内容:
class {
inputField = new Control();
constructor( private _broadcastService : BroadcastService) {
this.inputField.valueChanges
.debounceTime(300)
.subscribe(term => this._dropdownComponent.query(term));
}
}
selectReason(text, index) {
this.rejects[index].reason = text;
}
RT-dropdown 仅在您单击原因时发送原因。
问题是,当您单击原因时,{{reject.reason}} 会发生变化,但输入字段不会发生变化。
好像页面没有更新,有人对此有经验吗?
谢谢