Shadow DOM is part of the Web Components standard and enables DOM tree and style encapsulation.
Available since Chrome 35+
@Component({
providers: [HeroService]
})
export class AppComponent {
constructor(private _heroService: HeroService) { }
}
@Component({
providers: []
})
export class HeroComponent {
constructor(private _heroService: HeroService) { }
}
@Component({
selector: 'my-app',
template:`
{{title}}
My Heroes
`,
styles:[`
.heroes {
margin: 0 0 2em 0;
list-style-type: none;
padding: 0;
width: 10em;
}
`]
})
export class AppComponent {
...