发布于 2021-04-23 05:15:07
在select-input.component.html中,你犯了2个错误。
<ng-select #combo [ngClass]="
      controlDir && controlDir.control && controlDir.control.touched
        ? !controlDir.control.valid
          ? 'invalid-select'
          : 'valid-select'
        : null
    " placeholder="Select Type" [multiple]="multiple" [items]="items" bindLabel="{{ bindLabel }}"
    bindValue="{{ bindValue }}" [clearable]="clearable" (change)="onSelectionChange($event)" (focus)="onTouched()"
    ([ngModel])="(selectedValue)">
</ng-select>首先:[(ngModel)],他们叫它“盒子里的香蕉”,所以总是用括号括起来,而不是反过来。
第二:双引号内的术语不能用大括号括起来。
 [(ngModel)]="selectedValue"现在应该可以用了。
https://stackoverflow.com/questions/67220637
复制相似问题