-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Angular2 Universal support #6
Comments
@u12206050 Yup, it uses |
The main problem is the use of window.location.href, I believe angular does have a Location object that you can use. Luckily window.open() doesn't get called when rendering on the server so that isn't such a big deal. For others wanting to fix this, I did the following to fix the window.location.href: Replaced And then in server.ts where Universal is being called to render do the following:
|
@u12206050 I got it, it turned out that there's no |
Is this fixed now? |
@u12206050 I haven't played with Universal yet, but now sharebuttons will only use |
@u12206050 For opening share window which uses |
Could you just please do the following, it fixes compiling on universal side at least. |
@u12206050 okay it's merged now, please download the source manually and test it in your app, if it works I will push it to npm, because I'm not sure if it would work with btw, I tried to replace |
Ok, the changes should work, except that window and global are undefined in the context of typescript when compiling. I made a merge request with the interfaces for them. |
I tried to use it on a fresh Universal Starter installation, I imported |
Changes are merged and pushed to npm in 1.0.7 |
Did you make use of the share buttons on universal side or do you only render them client side? |
@u12206050 I just used it the same way I would use it in a normal angular app and it worked, I'm not sure what you mean by make use of them on universal side because I'm not technically familiar with universal yet. I have been told that global variables like |
This is related to the same issue MurhafSousli#6 where if you just try use window which is undeclared on Node then Angular Universal crashes. A simple check makes sure window is not undefined, before using it.
Am getting this error when trying to run ng2-buttons with Angular2's Universal (prerender) on the server side:
It works without prerender. This is a common error it seems in components that try to use window.
The text was updated successfully, but these errors were encountered: