<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 3 年前。
标签 css angular typescript
<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 3 年前。
我有两个 arbaic 布局和 english 布局的 css 文件,所以我想有条件地更改组件中的 styleurl。是否可能 ?
最佳答案
您不能在组件的 styleUrls 属性中放置条件,但您可以使用类似的东西:
.some-class {
// your css style
}
// arabic css overrides
._ar {
.some-class {
direction: rtl;
}
}
<div class="parent" [class._ar]="your_condition">
<textarea class="some-class">
</textarea>
</div>
关于css - 如何有条件地更改 Angular 组件中的样式 url?是否可以?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56866433/
相关文章:
css - Angular 4 CSS DIV 背景图像绑定(bind)不起作用
Access-Control-Allow-Origin 设置为 * 的 Angular 2 http 请求
由于意外字符 '#' 不在我的源代码中,因此 Angular 服务失败
javascript - json 响应 Angular 2 中的错误字符
javascript - 使用 HTML5 和 CSS 的深色模式开关
html - 试图将 flex 元素对齐到底部,但它们却对齐到文本的第一行
typescript - VSCode - 设置带有 Deno(后端)文件夹和 Vite(前端)文件夹的 monorepo