3

What is the correct way to load css files conditionally into a Component in angular 4+ ?

@Component({...
    styleUrls:['./rtl.css','./ltr.css']...
})

In my case I need to load Rtl/Ltr css conditionally depending on a param provided by a service (here called _translateService).

this._translateService.onLangChange.subscribe((event: LangChangeEvent) => {this.lang = event});
TKDev
  • 493
  • 1
  • 4
  • 19
  • check this answer https://stackoverflow.com/questions/36531486/dynamic-styleurls-in-angular-2 – Niladri Jun 04 '18 at 08:27
  • The post you gave is good, BUT... its not the angular way. Angular does not provide a way to load component css scripts dynamically? how come? – TKDev Jun 04 '18 at 14:31

0 Answers0