3

当我像这样将 CSS 导入 Angular 组件时:

 @Component({
   selector: 'hello-angular',
   styleUrls: ["./app.component.css"],   
   template: `<h1>Hello {{name}}</h1>`
 })

导轨返回错误

GET http://localhost:3000/app.component.css 406(不可接受)

但是当我像这样向组件添加样式时:

@Component({
  selector: 'hello-angular',
  styles: [`
    h1 {
        color: red;
    }
  `],
  template: `<h1>Hello {{name}}</h1>`
}) 

一切都很好。

是否可以使用 rails webpacker 导入外部组件 CSS?

4

0 回答 0