mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-08 07:41:51 +08:00
fix(ssr): fix angular global window and document references
This commit is contained in:
@ -6,7 +6,7 @@ import { Config, configFromSession, configFromURL, saveConfig } from './config';
|
||||
|
||||
declare const Context: any;
|
||||
|
||||
const win = Context['window'] ? Context['window'] : typeof (window as any) !== 'undefined' ? window : {} as Window;
|
||||
const win = typeof (window as any) !== 'undefined' ? window : {} as Window;
|
||||
|
||||
const Ionic = (win as any)['Ionic'] = (win as any)['Ionic'] || {};
|
||||
|
||||
@ -36,7 +36,7 @@ if (config.getBoolean('persistConfig')) {
|
||||
// first see if the mode was set as an attribute on <html>
|
||||
// which could have been set by the user, or by prerendering
|
||||
// otherwise get the mode via config settings, and fallback to md
|
||||
const documentElement = win.document ? win.document.documentElement : null;
|
||||
const documentElement = (win as any).document ? win.document.documentElement : null;
|
||||
const mode = config.get('mode', (documentElement && documentElement.getAttribute('mode')) || (isPlatform(win, 'ios') ? 'ios' : 'md'));
|
||||
Ionic.mode = Context.mode = mode;
|
||||
config.set('mode', mode);
|
||||
|
||||
Reference in New Issue
Block a user