I want to integrate only the NbChat into my project.
At first I just tried to integrate it normally in my whole project, but I got following error as soon as I try to use components with typescript logic (in this case logging in), when the NbThemeModule.forRoot({ name: 'corporate' })
is stated as an import in the app.module
and when the app.component.html
is wrapped in 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.....
Since this breaks everything in the Application, I though of placing the whole chat in a component exported by a sub module which exports it, and imports
NbThemeModule.forRoot({ name: 'corporate' }), NbLayoutModule, NbEvaIconsModule, NbChatModule
Vice Versa I import the self written ChatModule then in the app.module.ts
.
Since the same error happens for other people when Nebular Chat Components are not wrapt in nb-layout, so here you can see that the Chat Component is wrapped as follows.:
<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>
For some reason I still get the same error. Help is appreciated.
Update1:
While debugging with Chrome I got more specific Error Codes:
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)
While more testing, it seems like that only Importing NbTheme in any submodule, causes a conflict with all overlays (MatDialog, MatMenu, MatSnackbar, MatSideNav) of Angular Material.