小编unc*_*tin的帖子

如何始终显示 ng-select 的占位符?

我在 Angular 应用程序中使用 ng-select,并且有一个非常不寻常的用例。我需要始终显示占位符,即使在选定的选项上也是如此。在当前代码中,占位符将替换为所选选项的值:

<ng-select
  [(ngModel)]="selectedApplication"
  class="application-switcher"
  [attr.data-sel-id]="selId"
  [clearable]="false"
  appendTo="body"
  [searchable]="false"
  placeholder="{{ 'APP_TITLE' | translate }}"
  [virtualScroll]="virtualScroll"
  [markFirst]="false">
    <ng-option *ngFor="let application of applicationList" [value]="application">
      <div>
        {{ getApplicationName(application) }}
      </div>
    </ng-option>
</ng-select>
Run Code Online (Sandbox Code Playgroud)

angular-ngselect angular

8
推荐指数
2
解决办法
2万
查看次数

标签 统计

angular ×1

angular-ngselect ×1