Disable encapsulation

Both of these encapsulation features can be disabled on a per-component basis using the ViewEncapsulation.None switch in the following way:

import { Component, Input, ViewEncapsulation } from "@angular/core";@Component({    selector: "quiz-search",    templateUrl: './quiz-search.component.html',    styleUrls: ['./quiz-search.component.css'],    encapsulation: ViewEncapsulation.None})export class QuizSearchComponent {    @Input() class: string;    @Input() placeholder: string;}

With ViewEncapsulation.None, neither the HTML5 attribute nor the #shadow-root element will be used; this basically means that all the CSS classes defined for that component will be shared among all the other components and applied globally, just like the good old ...

Get ASP.NET Core 2 and Angular 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.