【发布时间】:2020-11-20 18:24:12
【问题描述】:
我不知道如何将 css 代码插入到我的 Angular 组件中。
let sheet: any = document.createElement('style');
sheet.type = "text/css";
sheet.textContent = `\n @keyframes ${this.config.animationConfig.name} { from { ${this.config.animationConfig.steps[0]} } to { ${this.config.animationConfig.steps[1]} } }`;
最好的问候,感谢您的帮助
乔纳兹
【问题讨论】:
-
只需将其添加到 html 头。无法将角度封装应用于动态样式,因为它应该发生在项目的编译阶段
标签: angular