IssueRaiser

Feature: @Directive should support styles and styleUrls properties

## I'm submitting a ... <!-- Check one of the following options with "x" --> <pre><code> [ ] Regression (behavior that used to work and stopped working in a new release) [ ] Bug report <!-- Please search github for a similar issue or PR before submitting --> [x] Feature request [ ] Documentation issue or request [ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question </code></pre> ## Current behavior Currently, if you have a `@Directive` that requires some custom styles you have to deal with the inclusion of styles, the `@Directive` does not accept `styles` and `styleUrls` (and maybe `encapsulation: None|Emulated`). ## Expected behavior The `DirectiveResolver` should accept `styles`, `styleUrls` (and `encapsulation: None|Emulated`) for the `@Directive` decorator. ## What is the motivation / use case for changing the behavior? ``` /** * Removes the spacing around an `md-list` component when it is a child of `md-card`. */ @Directive({ selector: 'md-list[my-md-list-in-card]', styles: [` md-list[my-md-list-in-card] { .mat-list-item-content { padding-left: 0 !important; padding-right: 0 !important; } } `] }) export class MyMdListInCardStylerDirective { } ```

Posted by SchnWalter on Jun 26, 2017, 9:58 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.4,500 issues0 comments

support (Software)

Feature: @Directive should support styles and styleUrls properties

SchnWalterJun 26, 2017, 9:58 AM

## I'm submitting a ... <!-- Check one of the following options with "x" --> <pre><code> [ ] Regression (behavior that used to work and stopped working in a new release) [ ] Bug report <!-- Please search github for a similar issue or PR before submitting --> [x] Feature request [ ] Documentation issue or request [ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question </code></pre> ## Current behavior Currently, if you have a `@Directive` that requires some custom styles you have to deal with the inclusion of styles, the `@Directive` does not accept `styles` and `styleUrls` (and maybe `encapsulation: None|Emulated`). ## Expected behavior The `DirectiveResolver` should accept `styles`, `styleUrls` (and `encapsulation: None|Emulated`) for the `@Directive` decorator. ## What is the motivation / use case for changing the behavior? ``` /** * Removes the spacing around an `md-list` component when it is a child of `md-card`. */ @Directive({ selector: 'md-list[my-md-list-in-card]', styles: [` md-list[my-md-list-in-card] { .mat-list-item-content { padding-left: 0 !important; padding-right: 0 !important; } } `] }) export class MyMdListInCardStylerDirective { } ```

Comments (0)

No comments yet. Start the discussion.

Comment on this issue