html - 不知道如何在 ngx-select-dropdown Angular 8 中设置选项

标签 html typescript angular8 ngx-bootstrap ngx-select-dropdown

我想在我的组件中获得一个下拉列表。

在我的 HTML 中,我有

<ngx-select-dropdown [options]="list"></ngx-select-dropdown>

在 TypeScript 文件中:

this.list = [
      {id:1,display:'job'},
      {id:2,display:'task'},
            ];
  }

如何在 .ts 中设置选项列表?使用“选项”是否正确?

最佳答案

是的。在官方文档中说:

options: Array - Array of string/objects that are to be the dropdown options.

您可以在这里阅读更多内容: https://github.com/manishjanky/ngx-select-dropdown#readme

关于html - 不知道如何在 ngx-select-dropdown Angular 8 中设置选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59665363/

相关文章:

typescript - 如何将 FabricJs 与 TypeScript 一起使用?

javascript - 单独或一起检查属性是否有意义?

javascript - Angular 8 和完整日历组件

angular - 如何手动完成 Angular http observable

php - 在 php 代码中插入复选框

css - 使用 Bootstrap 导航不适用于移动设备

javascript - Typescript - JSON 反序列化

javascript - 在 Angular 8/9 中,我可以确定 app.module.ts 内部的 URL 并在声明模块时使用它吗?

html - 为什么位置:sticky is not working when the element is wrapped inside another one?

javascript - 通过 javascript 链接到另一个带有书签的页面,这可能吗?