-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Description
Bug, feature request, or proposal:
Bug / clarification?
What is the expected behavior?
based on https://angular.io/docs/ts/latest/guide/component-styles.html#!#inspect-generated-css I would've expect all generated html to contain the _ngcontent attribute
What is the current behavior?
html tags generated within the component md-list-item (i.e. div with mat-list-item-content class) do not carry the _ngcontent attribute
What are the steps to reproduce?
See http://plnkr.co/edit/6PpJOw3E3AdpsLYc9v4T?p=preview for the example
in app.component.ts
@Component({
selector: 'material-app',
styles: [
'.mat-list {padding:20px; background-color:lightblue;}',
'.mat-list-item { padding: 10px; background-color: lightgreen; }',
'.mat-list-item-content { padding: 10px; background-color: red; }',
],
templateUrl: 'app.component.html'
})Angular converts this to
<style>.mat-list[_ngcontent-c0] {padding:20px; background-color:lightblue;}</style>
<style>.mat-list-item[_ngcontent-c0] { padding: 10px; background-color: lightgreen; }</style>
<style>.mat-list-item-content[_ngcontent-c0] { padding: 10px; background-color: red; }</style>The template contains
<md-list dense>
<md-list-item *ngFor="let item of items">
{{item.name}}
</md-list-item>
</md-list>but the html generated is this
<md-list _ngcontent-c0="" dense="" role="list" class="mat-list">
<!--bindings={"ng-reflect-ng-for-of": "[object Object],[object Object"}-->
<md-list-item _ngcontent-c0="" role="listitem" class="mat-list-item">
<div class="mat-list-item-content mat-ripple" md-ripple="" ng-reflect-disabled="true">
<div class="mat-list-text"></div>
one
</div>
</md-list-item>
.
.
.so the div is generated with class mat-list-item-content but no attribute, so the styles angular generates for mat-list-item-content are never applied as they are too specific.
As I wrote the above I began to wonder if this is as designed, and that any generated html not in the original template does not have _ngcontent attributes applied, in which case i'm trying to figure how you are meant to write css to effect mat-list-item-content?