[英]While using angular libraries, ng-zorro does not have its classes applied
I am using ng-zorro inside of an angular library I am creating.我在我正在创建的 angular 库中使用 ng-zorro。 When I include it in another project that has ng-zorro included and working, the elements that are being provided through the library aren't being rendered properly.
当我将它包含在另一个包含 ng-zorro 并正在运行的项目中时,通过库提供的元素无法正确呈现。
Correctly rendered button正确呈现的按钮
<button nz-button="" nztype="primary" class="ant-btn ant-btn-primary" ng-reflect-nz-type="primary"><!--bindings={
"ng-reflect-ng-if": "false"
}--><span>Primary</span></button>
Button provided through a library通过库提供的按钮
<button _ngcontent-yfk-c13="" nz-button="" nztype="primary">Primary</button>
Is it not possible to include ng-zorro through a library?不能通过库包含 ng-zorro 吗?
I faced this similar issue while creating an angular library which uses ng-zorro internally.我在创建内部使用 ng-zorro 的 angular 库时遇到了类似的问题。 In my case i had to import the ng-zorro styles in the library styles files.
就我而言,我必须在库 styles 文件中导入 ng-zorro styles。
In the library folder i added the following import in the CSS/SCSS files and it worked for me.在库文件夹中,我在 CSS/SCSS 文件中添加了以下导入,它对我有用。
@import "../../../../../../../node_modules/ng-zorro-antd/ng-zorro-antd.min.css";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.