Skip to content
This repository has been archived by the owner on Aug 25, 2020. It is now read-only.

Commit

Permalink
feat: multi-providing component styles
Browse files Browse the repository at this point in the history
  • Loading branch information
navix committed Aug 25, 2017
1 parent f7dbc11 commit ba28c2c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Provide styler view built-it module method:
```typescript
@Component({
...
viewProviders: [StylerModule.forComponent(NameStyle)],
viewProviders: [StylerModule.forComponent(ThisComponentStyle)],
```
Define style injectable:
Expand All @@ -159,7 +159,7 @@ import { Injectable } from '@angular/core';
import { ComponentStyle, StylerDefService, StyleDef } from '@ngx-kit/styler';

@Injectable()
export class NameStyle implements ComponentStyle {
export class ThisComponentStyle implements ComponentStyle {

constructor(private def: StylerDefService) {
}
Expand Down Expand Up @@ -206,7 +206,7 @@ export class NameStyle implements ComponentStyle {
### Multi-register
Styles deep-merged from left to right.
Styles deep-merged from left to right.
```typescript
this.styler.register([
Expand Down Expand Up @@ -239,6 +239,15 @@ this.styler.register([
]);
```
Provide few separated styles to component:
```typescript
viewProviders: [
StylerModule.forComponent(LayoutStyle),
StylerModule.forComponent(ThisComponentStyle),
],
```
### Fallback styles
TBD
Expand Down
4 changes: 0 additions & 4 deletions package/src/styler-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ export class StylerComponent implements OnDestroy {
this.stylerService.registerComponent(this);
if (componentStyle) {
this.register(componentStyle);
// create host element if defined
// if (this.componentStyle['host']) {
// this.createHostElement();
// }
}
}

Expand Down
1 change: 1 addition & 0 deletions package/src/styler.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class StylerModule {
{
provide: componentStyle,
useClass: componentStyleClass,
multi: true,
},
StylerComponent,
];
Expand Down

0 comments on commit ba28c2c

Please sign in to comment.