-
Notifications
You must be signed in to change notification settings - Fork 181
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
Angular material is not working on master branch (universal + material) #278
Comments
I think this workaround should fix the issue. I have not tried this solution myself. |
@thecodr material doesn't currently work with universal out of the box.... the hack in the link @ShankarSumanth posted is for the previous version of Universal before they brought it into the core repo. They say they will make material compatible with universal soon, so there's nothing I really need to do, it should simply work on a future update of material. I suppose that will be after this is merged: angular/components#4251 |
@qdouble angular/components#4251 is merged to master and I have tested locally. But Angular material is still not working in the current template. I am trying to figure out the root cause but want to let you know. |
@thecodr yeah, it appears they just haven't fully fixed material to work with universal yet...other than possibly using a different imports on the server than the browser, it shouldn't require much more than that if the problem is actually fixed on their end |
@qdouble Is there anything we can do on our side ? I am happy to help. This is one of the best starter pack available in terms of angular universal and unfortunately, dependency on another package is spoiling the game :( |
@thecodr The problem with trying to hack it, is every time there is an update to material or angular core, the hack may stop working as you'd be trying to manipulate private apis. I tried to do that early on, but gave up on that, because the project will just keep breaking or become non-upgradable and I don't see the point of using it in production if it's that unstable. If you see a workable solution in a different project, I can see about implementing it in this project, but for now, I'll just wait for them to solve the problem. |
@qdouble I agree with you regarding the hacks. I pulled your changes and tested. It does look like Angular Material has to catch up a lot!!!! |
Hi, I just stumbled upon this awesome project. The only think is that material isn't working. Of course the issue is already surfaced, but is there any chance it'll be resolved in the near future? Or is there a quick-fix for this? Or might it be better to use the non-universal? |
@alber70g as far as something production ready, the Angular team says they will fix the compatibility issue "soon," so that can mean next week or several months from now. If you need to launch your project right away and have it use universal, you may want to consider using the bootstrap branch or just not using the material module. Me personally, I'm just delivering my project with Material using a normal AOT build and will just switch over to Universal as soon as it's compatible. |
@qdouble Thank you for your advice. I'm not in desperate need for Universal, but I figured it'd be nice to start with. I've already installed the non-universal branch, and that one looks fine. |
@alber70g if you plan to use universal in the future, it would be better to just use the universal branch and just just run the regular build or compile command instead of the universal command. That way once the material issue is fixed, you'd just have to change build commands. The other issue is just because you're on the devServer, it should work fine on a normal server (or the prodserver). |
@alber70g in dev, you can use the reverse proxy option here if you need it to contact your actual api: https://github.com/qdouble/angular-webpack2-starter/blob/master/constants.js#L18-L21 |
I feel like I'm going off topic from the original issue here. But it seems that the /logout is an absolute URL instead of relative due to the inclusion of ${HOST} in http://${HOST}/logout. Shouldn't it be relative, or at least using the |
@alber70g it'd be dependent on your project, in my real project, the back office api is on a different port, so a relative URL wouldn't work... it's more so just an example, you can point it to where it should go for your actual project |
Hi !
I hope this help ! |
@julienR2 what file are you putting the ObserveContent stuff on? |
Oups sorry wasn't that clear indeed. |
@julienR2 could you show how your version of that file? |
Of course. However I have to specify I'm not using your repo, I landed on this issue looking for materials2 info, and though these info it could help. Anyway here is the main.server.ts
with the workaround included linde 4 that only contained
|
@julienR2 thanks. yes, the projects are similar as far as the server implementation... with that patch, I notice that some material elements work just fine, but others give this message on the console:
do you experience that as well? And what version of material are you using? |
I'm using the last version of material, 2.0.0-beta.5. |
@julienR2 I'm experiencing it even with MdInput. I just tested it out on the repo you're using and it gives the same results....(it shows the error in the server console, not the browser, so the input doesn't render until after the page is fully loaded). I did the webpack patch here: https://github.com/qdouble/ng-universal-demo-material-test/blob/master/webpack/webpack.server.js did I overlook anything or set something wrong? |
Arg, I'm not using MdInput.. And Since they refactored it few release ago it probably use createElement now.. Still some trouble so.. |
@julienR2 np, thanks for looking into it, keep me updated if you encounter any more workarounds... hopefully the material team will start catching up on these compatibility issues soon |
I will 👍 |
I'm currently using |
Hey you should make a branch using Materialize - its way better than angular material. Stable, easy to use, many features, only jQuery dependency but thats easy with webpack ProvidePlugin. |
By using pure Angular & Material Design on your project, you can create a performance app. |
material and universal should work together fine now |
Angular material seems to be broken on the master branch. There are other issues mentioning about universal in production and is this still relevant today @qdouble ? We are thinking of using this template in production and angular material is our high priority.
The text was updated successfully, but these errors were encountered: