You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 6, 2025. It is now read-only.
feat(core): add ability to override style building (#884)
This change decouples the style-generation from the actual directives, meaning that the library is now composed of the following:
* Directives that respond to inputs and `matchMedia` events
* Style generation providers that return styles when triggered by directives
This allows for end-users or library authors to provide their own unique style generation (even by borrowing or extending our existing library code) for any directive. This is entirely non-mandatory for use of the `BaseDirective`, since the `BaseDirective` need not always use a de-coupled style provider to function.
The canonical example is the following:
```ts
@Injectable()
export class CustomStyleBuilder extends StyleBuilder {
buildStyles(input: string) {
return {
'style1': 'value1',
};
}
}
@NgModule({
...
providers: [
provide: <the style builder to orverride, e.g. FlexStyleBuilder>,
useClass: CustomStyleBuilder,
],
})
export class MyAppModule {}
```
Fixes#689
0 commit comments