Angular route to have no inherited CSS

Issue

I would like to have a url for an angular project which has no CSS inherited from the main CSS file. I have looked into it but when I try I keep getting the inherited CSS.

I only want to use the CSS provided on the component itself.

Solution

This is not related to Angular, that’s just normal browser behavior.

You can use shadow DOM where supported

@Component({
  selector: '...',
  viewEncapsulation: ViewEncapsulation.Native,
})
export class MyComponent {}

I don’t know which browsers already support that.

Answered By – Günter Zöchbauer

Answer Checked By – Marie Seifert (AngularFixing Admin)

Leave a Reply

Your email address will not be published.