【问题标题】:How to apply a default value to an IgxSelectComponent如何将默认值应用于 IgxSelectComponent
【发布时间】:2021-03-22 21:51:03
【问题描述】:

使用这样的模板将默认值应用于IgxSelectComponent 的推荐方法是什么?:

<igx-select type="string" formControlName="classification">
    <label igxLabel>Classification</label>
    <igx-select-item *ngFor="let classification of classifications$ |async" [value]="classification">
        {{classification}}
    </igx-select-item>
</igx-select>

提前致谢!

【问题讨论】:

  • 最好也发布 .ts 文件的内容,包括表单组和分类 $ 定义。

标签: angular infragistics ignite-ui ignite-ui-angular


【解决方案1】:

您可以使用ngModel 指令将默认值设置为IgxSelectComponent,并将其绑定到存储所需默认值的全局变量:

<igx-select [(ngModel)]="selected">
  <label igxLabel>Simple Select</label>
  <igx-select-item *ngFor="let item of items" [value]="item">
    {{item}}
  </igx-select-item>
</igx-select>

Here 可以找到一个简单的示例应用程序,您可以自己进行测试。

另外,关于 Infragistics Select Component 的有用主题可以在 here 找到。

【讨论】:

    猜你喜欢
    • 2021-09-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-28
    • 1970-01-01
    • 2022-12-04
    • 2010-10-13
    相关资源
    最近更新 更多