小编Muh*_*eef的帖子

如何将角度组件传递给 Nebular 对话服务

我正在尝试使用Nebular组件在 Agnular6 上创建一个 Web 对话框。有两种方法可以做到这一点,第一种是传递<ng-template>引用,例如:

  openAddDialog = (dialogTemplate: TemplateRef<any>) => {
    this.dialogServiceRef = this.dialogService.open(dialogTemplate);
  }
Run Code Online (Sandbox Code Playgroud)

它运行良好。但我需要的是将组件作为参数传递,例如:

dialogService.open(MyComponent);
Run Code Online (Sandbox Code Playgroud)

我的应用程序中有这个结构:

|_ pages
|   |_ pages.module.ts
|   |_ patient
|      |_ patient.module.ts
|      |_ patient.component.ts
|      |_ patient.component.html
|
|_ shared
    |_ shared.module.ts
    |_ components
    |   |_ search-bar.component.ts
    |   |_ search-bar.component.html
    |
    |_ modal-form
        |_ modal-form.component.ts
        |_ modal-from.component.html
Run Code Online (Sandbox Code Playgroud)

我已经添加了ModalFormComponentdeclarationsexportsentryComponents共享的模块中。此外,我将它导入到 SearchBar 组件中,并在单击 searchBar 中的按钮时运行此函数:

|_ pages
|   |_ pages.module.ts
|   |_ patient …
Run Code Online (Sandbox Code Playgroud)

dialog typescript angular6 ngx-admin nebular

7
推荐指数
2
解决办法
9962
查看次数

标签 统计

angular6 ×1

dialog ×1

nebular ×1

ngx-admin ×1

typescript ×1