Angular 4 + Cordova + Device Ready

I don't know if this is the best approach but in my main.ts I added the deviceready event listener with an arrow function which calls the angular bootstrap. It works.

document.addEventListener("deviceready", () => platformBrowserDynamic().bootstrapModule(AppModule), false);

If you need to add a check for Cordova as well, you need more complex code. Otherwise Angular will complain about 'Tried to find bootstrap code, but could not. Specify either statically analyzable bootstrap code or pass in an entryModule to the plugins options.'

const bootstrap = () => {

if (typeof window['cordova'] !== 'undefined') {
  document.addEventListener('deviceready', () => {
  }, false);
} else {