2
我無法在組件中使用styleUrls
+ styles
(它看起來是最後一次被使用的聲明)。解決這個問題的最佳方法是什麼?Angular 2,StyleUrls + Styles
我想使用./board.component.css
來聲明基本樣式,但想要添加terrainStyles
字符串,它使用來自數據庫的邏輯+數據生成。
我知道我可以將所有樣式寫成字符串,但我想將我的大部分樣式保留在CSS文件中。有沒有一種很好的方法將邏輯包含在css文件中?或者我沒有考慮過的東西?
Component({
selector: 'board',
templateUrl: './board.component.html',
styleUrls: ['./board.component.css'],
styles: [terrainStyles] // string generated using typescript logic
})
export class BoardComponent implements OnInit {
// ...
}
CSS'@ import' rule – Dummy