0

I'm trying to manually bootstrap an Angular application from the callback of an external library ie the inbox sdk.

Current behaviour

At the moment the application bootstraps and renders the initial state of the app but further changes to the app / component state do not cause re renders. ngAfterViewChecked or ngDoCheck are never fired again after the initial render.

Bootstrapping outside the of library's callback works fine with change detection. Unfortunately I do need to bootstrap on library calls...

Change detection is all set to default and otherwise it's a standard Angular 7 app built through the CLI.

Here is a working example of the app

The demo breaks if instead of bootstrapping the default way we bootstrap via the library callback as shown below.

src/app/app.module.ts:Appmodule.ngDoBootstrap

  ...
  inboxSDK.subscribe((sdk) => {
    this.bootstrapGmail(app, sdk)
  })
  ...

Unfortunately, it's hard to recreate this exact scenario in a jsfiddle as the inbox sdk won't work without the gmail environment and an API key.

david_adler
  • 9,690
  • 6
  • 57
  • 97
nick
  • 3,521
  • 3
  • 22
  • 32
  • i mean, it's a little hard to help you troubleshoot when you don't post any code. Admittedly the library itself is closed-source, but without a reproducible example, we're just tilting at windmills. – Roddy of the Frozen Peas Dec 11 '18 at 15:36
  • @RoddyoftheFrozenPeas updated with some code. Hope that helps – david_adler Dec 12 '18 at 14:17
  • Seeing that StackBlitz code, isn't your AppModule class missing the `implements DoBootstrap` part, to tell Angular it need to execute the method? – schmkr Oct 31 '19 at 14:31

0 Answers0