-
Notifications
You must be signed in to change notification settings - Fork 26.6k
Closed
Description
I'm running into an issue with applying styles to custom elements. I'm not sure if it is a bug or my lack of understanding. I have a simple component called <my-cmp></my-cmp>
which I want to apply styles to it as part of the component definition.
Here is an example of my components and what I'm trying to do.
import {Component, CORE_DIRECTIVES} from 'angular2/angular2'
@Component({
selector: "my-cmp",
template: `
<ng-content></ng-content>
`,
styles: [`
my-list {
display: block;
border: 1px solid black;
min-height: 200px;
}
`]
})
export class MyCmp {}
@Component({
selector: 'my-app',
template: `
<h2>Angular 2 Styles Issue?</h2>
<my-cmp>
<p>Why are style's not being applied to custom component selector "my-list"?</p>
</my-cmp>
`,
directives: [CORE_DIRECTIVES, MyCmp]
})
export class App {}
I would expect the outputted html to look something like this with the styles applying directly to the my-cmp. MyComponent should have a border around it but nothing is applied to it.
<my-app>
<my-cmp>
<p>Why are style's not being applied to custom component selector "my-list"?</p>
</my-list>
</my-cmp>
Here is a plunker demonstrating this example.
http://plnkr.co/edit/w6EYcxLDsLaXXjhdHDh0
Metadata
Metadata
Assignees
Labels
No labels