angular 4 universal - include module if browser

Viewed 768

So a few of the packages I'm using don't work on universal. I was wondering if there was a way where we could only load specific modules if we are on server.

Currently according the official repo you can check if you are in browser or server inside a component using this technique:

constructor(@Inject(PLATFORM_ID) private platformId: Object) { ... }

...
if (isPlatformBrowser(this.platformId)) {...}

However, if I could check whether currently we are in browser or server via some sort of global variable, selecting which module to load would become trivial.

1 Answers
Related