Skip to content

Commit

Permalink
fix(theme): fix window and document providers to work in AOT (#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
nnixaa authored Apr 3, 2018
1 parent 354a1a5 commit 0aa898b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"lint:fix": "npm run lint -- --fix",
"pree2e": "webdriver-manager update --standalone false --gecko false",
"e2e": "ng e2e",
"e2e:wp": "ng e2e --app playground-wp",
"e2e:wp": "ng e2e --prod --aot --app playground-wp",
"prepush": "npm run ci:lint",
"clean:tmp": "rimraf .ng_build .ng_compiled",
"clean:tmp:lib": "npm run clean:tmp && rimraf src/.lib",
Expand Down
11 changes: 9 additions & 2 deletions src/framework/theme/theme.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ import {
NbMediaBreakpointsService,
} from './services/breakpoints.service';

export function nbWindowFactory() {
return window;
}

export function nbDocumentFactory() {
return document;
}

@NgModule({
imports: [
Expand Down Expand Up @@ -57,8 +64,8 @@ export class NbThemeModule {
{ provide: nbBuiltInJSThemesToken, useValue: BUILT_IN_THEMES },
{ provide: nbJSThemesToken, useValue: nbJSThemes || [] },
{ provide: nbMediaBreakpointsToken, useValue: nbMediaBreakpoints || DEFAULT_MEDIA_BREAKPOINTS },
{ provide: NbWindow, useValue: window },
{ provide: NbDocument, useValue: document },
{ provide: NbWindow, useFactory: nbWindowFactory },
{ provide: NbDocument, useFactory: nbDocumentFactory },
NbJSThemesRegistry,
NbThemeService,
NbMediaBreakpointsService,
Expand Down

0 comments on commit 0aa898b

Please sign in to comment.