Skip to content

Commit

Permalink
fix(angular): add double initialize warning (#19393)
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Sep 20, 2019
1 parent 123d0f3 commit e98769e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions angular/src/app-initialize.ts
Expand Up @@ -5,10 +5,16 @@ import { Config } from './providers/config';
import { IonicWindow } from './types/interfaces';
import { raf } from './util/util';

let didInitialize = false;

export const appInitialize = (config: Config, doc: Document, zone: NgZone) => {
return (): any => {
const win: IonicWindow | undefined = doc.defaultView as any;
if (win) {
if (didInitialize) {
console.warn('Ionic Angular was already initialized. Make sure IonicModule.forRoot() is just called once.');
}
didInitialize = true;
const Ionic = win.Ionic = win.Ionic || {};

Ionic.config = {
Expand Down

0 comments on commit e98769e

Please sign in to comment.