【发布时间】:2018-09-25 23:06:59
【问题描述】:
我想在 styleUrls 中使用多 CSS
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: [condition 'if' for Which load css]
})
我累了
【问题讨论】:
标签: angular
我想在 styleUrls 中使用多 CSS
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: [condition 'if' for Which load css]
})
我累了
【问题讨论】:
标签: angular
你可以在里面使用三元运算符:
const url1 = './foo.css';
const url2 = './bar.css';
let condition = true
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: [condition ? url1 : url2]
})
【讨论】:
你可以内联写一个三元运算符:
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: [condition ? 'someFile.css' : 'someOtherFile.css']
})
【讨论】:
x-button vsx-button.red) 和自己的风格url