我已将反应形式和ng-select连接起来,现在我可以很顺利地获得该值,但是当我尝试以任何方式修补该值均不起作用时,
在这里帮我
我尝试
this.profileForm.patchValue({
cuns: [{ID: 69}],
});
this.profileForm.controls['cuns'].setValue(69, {onlySelf: true});
还有更多,这是我的html
<ng-select [items]="this.allCits"
formControlName="cits"
[multiple]="true"
bindLabel="CityNameProfile1"
bindValue="ID">
<ng-template ng-label-tmp let-item="item">
<b>{{item.CityNameProfile1}}</b>
</ng-template>
<ng-template ng-option-tmp let-item="item" let-item$="item$" let-index="index">
<input id="item-{{index}}" type="checkbox" [ngModel]="item$.selected" [ngModelOptions]="{standalone: true}"/> {{item.CityNameProfile1}}
</ng-template>
<ng-template ng-option-tmp let-item="item" let-index="index" let-search="searchTerm">
<b [ngOptionHighlight]="search">{{item.CityNameProfile1}}</b>
</ng-template>
</ng-select>