Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

Commit

Permalink
fix(module): do not require breakpoints in withConfig (#853)
Browse files Browse the repository at this point in the history
Fixes #846
  • Loading branch information
livthomas authored and CaerusKaru committed Oct 5, 2018
1 parent 5ddccb5 commit 76c110e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ node_modules
# IDEs
/.idea
/.vscode
/*.iml

# misc
.DS_Store
Expand Down
30 changes: 10 additions & 20 deletions src/lib/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,18 @@ export class FlexLayoutModule {
* which sets the corresponding tokens accordingly
*/
static withConfig(configOptions: LayoutConfigOptions,
breakpoints?: BreakPoint|BreakPoint[]): ModuleWithProviders {
breakpoints: BreakPoint|BreakPoint[] = []): ModuleWithProviders {
return {
ngModule: FlexLayoutModule,
providers: Array.isArray(breakpoints) ?
configOptions.serverLoaded ?
[
{provide: LAYOUT_CONFIG, useValue: configOptions},
{provide: BREAKPOINT, useValue: breakpoints, multi: true},
{provide: SERVER_TOKEN, useValue: true},
] : [
{provide: LAYOUT_CONFIG, useValue: configOptions},
{provide: BREAKPOINT, useValue: breakpoints, multi: true},
]
:
configOptions.serverLoaded ?
[
{provide: LAYOUT_CONFIG, useValue: configOptions},
{provide: SERVER_TOKEN, useValue: true},
] :
[
{provide: LAYOUT_CONFIG, useValue: configOptions},
]
providers: configOptions.serverLoaded ?
[
{provide: LAYOUT_CONFIG, useValue: configOptions},
{provide: BREAKPOINT, useValue: breakpoints, multi: true},
{provide: SERVER_TOKEN, useValue: true},
] : [
{provide: LAYOUT_CONFIG, useValue: configOptions},
{provide: BREAKPOINT, useValue: breakpoints, multi: true},
]
};
}

Expand Down

0 comments on commit 76c110e

Please sign in to comment.