Style html,body from web component (Angular 2)

You need to change the way your component serves css using ViewEncapsulation. By default it’s set to Emulated and angular will

add an attribute containing surrogate id and pre-process the style rules

To change this behavior import ViewEncapsulation from 'angular2/core' and use it in component’s metadata:

@Component({
  ...
  encapsulation: ViewEncapsulation.None,
  ...
})

Leave a Comment