I am trying to use NbChatComponent in my Angular application without applying the whole Nebular theme styles. How to get the default nebular style only apply to the Angular component which uses NbChatComponent? Any samples?
Thank you very much in advance for your help.
Henry
Hi @henryyue2010. You can do this by calling mixins for individual components inside nb-install. Since chat is using a button, input and icon components under the hood you need to include styles for these components as well. Also, you need to keep track of module dependencies added in the future as it potentially could require more styles to be added.
To sum up:
styles.scss to have styles in nb-install only for the chat and it's dependencies:@include nb-install() {
@include nb-chat-theme();
@include nb-icon-theme();
@include nb-buttons-theme();
@include nb-input-theme();
};
Hi @yggg , I'm trying to do exactly the same thing, ie import the component chat only into a component. I use for the rest of my Material Angular application and it seems that the 2 comes into conflict (it's a shame). I did what you said but I'm still full of error type ERROR TypeError: Can not read property 'appendChild' of undefined, distorted images, ... How to really limit nebular to a single component?
Me too, I am having the same problem and I really need and answer How to really limit nebular to a single component?
Me too, I am having the same problem and I really need and answer How to import the chat component only into my application without applying the whole theme styles to the application?
You can use Angular Elements (Web components)
Me too, I am having the same problem and I really need and answer How to import the chat component only into my application without applying the whole theme styles to the application?
Hi, there is how I use only one component for project without apply style to another component.
ng add @nebular/theme or by manually. <nb-layout>
<nb-layout-header fixed>Company Name</nb-layout-header>
<nb-sidebar>Sidebar Content</nb-sidebar>
<nb-layout-column>
Page Content <button nbButton>Hello World</button>
</nb-layout-column>
</nb-layout>
<nb-layout>
<nb-layout-column>
<Your nebular HTML go here>
</nb-layout-column>
</nb-layout>
P/S: there will be redundant over there and there but at least nebular style will not apply over other component of your project. Maybe better solution out there, better keep looking :eyes:
For those dealing with the problem Nebular causes with ERROR TypeError: Can not read property 'appendChild' of undefined while trying to use just a single Nebular component, there's an easy fix I just found.
Go to your app.module.ts and in the providers array (add one if you don't have one) add { provide: OverlayContainer } and it should fix the issue for the most part.
Most helpful comment
Hi @yggg , I'm trying to do exactly the same thing, ie import the component chat only into a component. I use for the rest of my Material Angular application and it seems that the 2 comes into conflict (it's a shame). I did what you said but I'm still full of error type
ERROR TypeError: Can not read property 'appendChild' of undefined, distorted images, ... How to really limit nebular to a single component?