【问题标题】:How to use NbWindowService in nebular to open a form in another component如何在nebular中使用NbWindowService在另一个组件中打开表单
【发布时间】:2019-09-02 22:15:52
【问题描述】:

我正在使用 MEAN Stack 框架实现一个系统。有一个标题组件。在标题组件中,我设计了一个名为“发布”的按钮。当我单击该按钮时,它应该打开一个内容为表单的窗口。该表单是在“FormComponent”中设计的。

这是我的 header.component.html。

<button (click)="openWindow()" nbButton type="button" size="small">Post</button> 

header.component.ts

openWindow() {
 this.windowService.open(FormComponent, { title: `Post` });
}

FormComponent.html

<form>
  First name:<br>
  <input type="text" name="firstname"><br>
</form>

当我单击“发布”按钮时,它会打开窗口。但它没有显示 'FormComponent' 中的 .html 文件中的内容。谁能告诉我哪里出错了?

【问题讨论】:

    标签: angular6 mean-stack nebula ngx-admin


    【解决方案1】:

    您可以使用浏览器控制台找到错误。您的错误可能是因为您没有将 FormComponent 添加为 entryComponent。所以通过引用https://codinglatte.com/posts/angular/entry-components-angular/将FormComponent添加到module.ts文件中的entryComponents数组中

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-09
      • 2017-02-01
      • 1970-01-01
      • 2015-03-08
      • 1970-01-01
      相关资源
      最近更新 更多