Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 仅针对一个模块和组件的角度星云聊天_Angular_Typescript_Angular Material_Nebular - Fatal编程技术网

Angular 仅针对一个模块和组件的角度星云聊天

Angular 仅针对一个模块和组件的角度星云聊天,angular,typescript,angular-material,nebular,Angular,Typescript,Angular Material,Nebular,我只想将NbChat集成到我的项目中。 起初,我只是尝试在我的整个项目中正常地集成它,但是当NbThemeModule.forRoot({name:'corporate')出现以下错误时,我尝试使用带有类型脚本逻辑的组件(在本例中是登录的)在app.module中声明为导入,并且当app.component.html包装在NbLayout中时: ERROR Error: Uncaught (in promise): TypeError: this.container is undefined _

我只想将NbChat集成到我的项目中。 起初,我只是尝试在我的整个项目中正常地集成它,但是当
NbThemeModule.forRoot({name:'corporate')出现以下错误时,我尝试使用带有类型脚本逻辑的组件(在本例中是登录的)
app.module
中声明为导入,并且当
app.component.html
包装在NbLayout中时:

ERROR Error: Uncaught (in promise): TypeError: this.container is undefined
_createContainer@http://localhost:4200/vendor.js:80244:9
getContainerElement@http://localhost:4200/vendor.js:178191:18
_createHostElement@http://localhost:4200/vendor.js:180093:32
create@http://localhost:4200/vendor.js:180060:27
_createOverlay@http://localhost:4200/vendor.js:112117:30
_attach@http://localhost:4200/vendor.js:112026:33
openFromComponent@http://localhost:4200/vendor.js:111963:21
open@http://localhost:4200/vendor.js:111991:21
login/<@http://localhost:4200/main.js:7096:68
__awaiter/<@http://localhost:4200/vendor.js:167019:71
ZoneAwarePromise@http://localhost:4200/polyfills.js:1317:33
__awaiter@http://localhost:4200/vendor.js:167015:12
login@http://localhost:4200/main.js:7084:75.....
反之亦然,我导入自写聊天模块,然后在
app.module.ts
中导入

由于当Nebular聊天组件未包装在nb布局中时,其他人也会发生同样的错误,因此在这里您可以看到聊天组件包装如下:

<nb-layout>
   <nb-layout-column>
    <nb-chat title="Drag & Drop chat" size="medium">
        <nb-chat-message *ngFor="let msg of messages"
                         [type]="msg.type"
                         [message]="msg.text"
                         [reply]="msg.reply"
                         [sender]="msg.user.name"
                         [date]="msg.date"
                         [files]="msg.files"
                         [avatar]="msg.user.avatar">
        </nb-chat-message>
        <nb-chat-form (send)="sendMessage($event)" [dropFiles]="true"></nb-chat-form>
      </nb-chat>
   </nb-layout-column>
</nb-layout>
   

在进行更多测试时,似乎只有在任何子模块中导入NbTheme会导致与所有覆盖冲突(MatDialog、MatMenu、MATNACKBAR、MatSideNav)角度材料。

您是否有机会解决此问题?我发现解决此问题的唯一方法是将整个app.component.html包装在其中,并通过css使其尽可能不受影响。在那里,我偶尔会和一些马纳克巴尔发生冲突,在受影响的位置,我用烤面包代替它们。因为这不是一个“真正的”解决方案,我把它放在这里的评论
<nb-layout>
   <nb-layout-column>
    <nb-chat title="Drag & Drop chat" size="medium">
        <nb-chat-message *ngFor="let msg of messages"
                         [type]="msg.type"
                         [message]="msg.text"
                         [reply]="msg.reply"
                         [sender]="msg.user.name"
                         [date]="msg.date"
                         [files]="msg.files"
                         [avatar]="msg.user.avatar">
        </nb-chat-message>
        <nb-chat-form (send)="sendMessage($event)" [dropFiles]="true"></nb-chat-form>
      </nb-chat>
   </nb-layout-column>
</nb-layout>
   
core.js:4197 ERROR TypeError: Cannot read property 'appendChild' of undefined
at NbOverlayContainerAdapter._createContainer (index.js:2116)
at NbOverlayContainerAdapter.getContainerElement (overlay.js:735)
at Overlay._createHostElement (overlay.js:2637)
at Overlay.create (overlay.js:2604)
at MatDialog._createOverlay (dialog.js:673)
at MatDialog.open (dialog.js:632)
at ActivejobsComponent.openJobCreation (activejobs.component.ts:72)
at ActivejobsComponent_div_1_Template_button_click_5_listener (activejobs.component.html:9)
at executeListenerWithErrorHandling (core.js:14309)
at wrapListenerIn_markDirtyAndPreventDefault (core.js:14344)