预构建的Angular Material Theme在库中的工作方式与在角度应用程序中不同。在projects / example-lib文件夹中创建了一个style.css文件,并在其中导入了预先构建的靛蓝粉色主题。根据文档,我应该将其包含在angular.json文件中,但是这样做时,出现以下错误
Schema validation failed with the following errors:
Data path "" should NOT have additional properties(styles).
Angular Material设计组件(Mat-Tabs等)在我的库中可用,但是 Angular Material主题不起作用。我还尝试将以下内容添加到我的styles.css中,
@import "~@angular/material/prebuilt-themes/indigo-pink.css";
这也不起作用。我认为由于style.css文件未全局定义,因此未应用预建主题。还向库的根组件添加了ViewEncapsulation.None来删除封装。它似乎对我不起作用。