Alyle-UI icon indicating copy to clipboard operation
Alyle-UI copied to clipboard

Add angular universal support

Open BruneXX opened this issue 4 years ago • 3 comments

Hi Guys, I'm facing this issue and I think is related to universal since cannot find the navigator because need to use isPlatformBrowser can you add these feature?

/ng-app/node_modules/@alyle/ui/bundles/alyle-ui.umd.js:169
 Platform.EDGE = Platform.isBrowser && /(edge)/i.test(navigator.userAgent);

ReferenceError: navigator is not defined

BruneXX avatar Dec 18 '19 20:12 BruneXX

I've found the file where the modifications need to be placed: https://github.com/A-l-y-l-e/Alyle-UI/blob/master/src/lib/src/platform/platform.ts

BruneXX avatar Dec 18 '19 21:12 BruneXX

Hi @BruneXX, this already has universal angular support.

This happens when in your file running on node js document is defined, you should remove that line that defines document. It must be like: (global as any).document = ...

Enlcxx avatar Dec 18 '19 22:12 Enlcxx

Although this could be resolved by improving the conditionals in Platform.isBrowser, I will add it for the next release. Thanks for reporting this.

Enlcxx avatar Dec 18 '19 22:12 Enlcxx