我只需要为一个组件导入ignite-ui样式。
组件:
@Component({
selector: 'app-detailed-report',
templateUrl: './detailed-report.component.html',
styleUrls: ['./detailed-report.component.css'],
encapsulation: ViewEncapsulation.ShadowDom
})
Css:
@import "../../../../../../../../node_modules/igniteui-angular/styles/igniteui-angular.css";
或
@import "~igniteui-angular/styles/igniteui-angular.css";
这不起作用。但是,如果我将encapsulation: ViewEncapsulation.ShadowDom
更改为encapsulation: ViewEncapsulation.None
,则会应用样式。但是,如果我转到其他组件,这些样式也会应用于它们。我只需要为一个组件应用样式
答案 0 :(得分:2)
@Component({
selector: 'app-detailed-report',
templateUrl: './detailed-report.component.html',
styleUrls: [
'./detailed-report.component.css',
'../../../../../../../../node_modules/igniteui-angular/styles/igniteui-angular.css' // make sure it's the right path
],
encapsulation: ViewEncapsulation.ShadowDom
})
或切换到scss
并将其导入样式文件
@import "~igniteui-angular/styles/igniteui-angular.css";
css
没有导入语句