Dynamic styleUrls in angular 2?

后端 未结 5 1576
借酒劲吻你
借酒劲吻你 2020-11-30 07:50

Is it possible to dynamically inject urls to stylesheets into a component?

Something like:

styleUrls: [
  \'stylesheet1.css\',
  this.additionalUrls
         


        
5条回答
  •  甜味超标
    2020-11-30 07:58

    I don't think you can have dynamic stylesheet URLs, because you cannot access your class property or method inside @Component decorator.

    But you can achieve your goal by having dynamic style classes in your template.

提交回复
热议问题