要解决这个问题,可以尝试以下几个步骤:
Hello, world!
.my-style {
background-color: red;
}
import './my-component.css';
ViewEncapsulation.None
来禁用视图封装。例如:import { Component, ViewEncapsulation } from '@angular/core';
@Component({
selector: 'my-component',
templateUrl: './my-component.html',
styleUrls: ['./my-component.css'],
encapsulation: ViewEncapsulation.None
})
export class MyComponent {}
希望以上解决方法对你有帮助!