-
Notifications
You must be signed in to change notification settings - Fork 139
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
add support for angular2-universal #140
Comments
From looking at it at a glance, it looks like this library requires jQuery/hammerJS and has a few small references to Unless these requirements were removed, I'd imagine this would be more in our ballpark on the Angular Universal side to at least (attempt) to support some of these features, which would slow down server rendering, or at least ignore them somehow (which means they just won't get rendered on the server-side). You can see the issue here (angular/universal#534), but it's nothing something I imagine we'll be able to implement soon as it's a huge overhaul. :( |
@MarkPieszak Ok thanks i guess ill have to look for a different CSS framework, do you know if there is a list with compatible css frameworks? (the only one i know is bootstrap). |
ng2-bootstrap ng-bootstrap (think they have one issue with Carousel remaining to work perfectly with Universal) Both work very well with Universal, they have no jQuery dependencies and have fixed any window/document references/etc. Not sure why both teams didn't just combine their efforts :( |
After moving to the Angular CLI this is now part of the library. |
@rubyboy How so? The library still relies on browser globals in entry point and custom-event-polyfill. |
@bisubus is there anything we can do in the library to support angular universal? I thought we'd need support in MaterializeCSS itself. |
@rubyboy Definitely yes. I tried to go Universal before, and the ng2-materialize was one of the few show-stoppers. The app will fail to bootstrap if MaterializeModule is included on server side, and it will fail if it's not (at least because Should we assume that |
@bisubus I'd actually assume that Materialize does do DOM changes. Worth checking in the original repo. |
@rubyboy Sure, we'll see how things go. I've checked how it's going in Angular Material, and it looks like it still isn't ready for Universal, see angular/components#308, but there's supposed to be a separate entry point for server side, like The good thing is that in Materialize most visuals are implemented with CSS, while JS does interaction with user. Until JS part will be rewritten to native Angular DOM manipulation like @MarkPieszak suggested, I guess that stubbing Another direction I see is that browser part ( What do you think? |
I've reopened this issue, to keep it in the correct state. @bisubus as you said, we do need to put some effort in supporting universal. |
Hi there, It would be great help if anyone can tell me, how to remove the |
@susheelbanyal To my knowledge, it's currently better to not include |
How can we do that? any code sample? |
Nope, no code, sorry. Create a dummy MaterializeDirective that has same inputs as real directive and include it instead of angular2-materialize. This is same thing that's usually done in unit tests. |
I'm also banging my head against the wall trying to implement Angular Universal with materialize. The error I get is the following...
That's a major bummer. Had I known I'd run into such issues I wouldn't have started a project with materialize. Had no idea at the time that I'd need to use Angular Universal :/ |
@biskazz The issue doesn't have to do anything with Universal or this package but is specific to your build process. You may also try |
I have successfully used angular2 materialize in angular universal project.
|
@ssatz can you share the code here. I am facing the same issue. I have added the above code but failing at Cannot set property 'default' of undefined @ exports.default = Materialize. |
@karunya2530 : find the below gist link for server.ts file EDIT: Ignore the above gist file, it is for latest alpha version materialize css without jquery.
|
Hi Sathish,
How are you doing, hope doing well. This is punit here, i comment on one of
the github issue for the mentioned subject and u shared me the server.ts as
you can see in mail trial i have used same server.ts contents and code as
you wrote, but i am facing some issue with materializecss still, is it
possible for you to share me webpack.config.js and package.json contents
urgently because i am stucked to this issue from so many days and i have
tried all posible solutions but i am not getting it done . It would be
great help from you if you could help to solve this issue.
You can reply me on the same email.
Will wait for response.
Thanks in advance for your help and support
Regards,
Punit
…On Thu, 1 Mar 2018, 13:39 sathish, ***@***.***> wrote:
@karunya2530 <https://github.com/karunya2530> : find the below gist link
for server.ts file
https://gist.github.com/ssatz/9e894070af27a7b9233ff25eb6f8cc2d
<http://url>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#140 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AjNzlC5ycfqO-TsC2sNBEeV4RDCd3NJEks5tZ6zOgaJpZM4KZCh0>
.
|
@karunya2530: here is the sample repo |
Hi Satish, I did followed the sample repo but yet i am facing this error ReferenceError: Hammer is not defined Do you have any idea to resolve this ?? |
Hi,
i think you need to install the hammerjs .
Materialize css depends on hammerjs for touch interface.
Note: This seems to be a long trail. You can PM me via mail.
Best Regards,
sathish kumar
…On Tue, Mar 13, 2018 at 12:04 PM, karunya2530 ***@***.***> wrote:
Hi Satish,
I did followed the sample repo but yet i am facing this error
factory(jQuery, Hammer);
^
ReferenceError: Hammer is not defined
Do you have any idea to resolve this ??
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#140 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGkq0kYlY2M0F_PoqO3dTqYdK7xvtJVKks5td2hfgaJpZM4KZCh0>
.
|
Hi, app\node_modules\domino\lib\utils.js:41 |
I think i am using chart.js and this is causing the server.js to fail to execute. Do you have any idea on this ?? |
checkout the link here
note : mail me sathish.thi[@]gmail.com . I won't reply here |
Initially I followed @ssatz's way to circumvent the problem of not having the window object during SSR. Since these Directives aren't very much useful in SSR, it is better to gracefully disable them via platform checking. |
@joscmw95 👍 Seems to be awesome. |
As far as I am aware, materialize-css version 1.0.0-rc.2 no longer requires jquery. So technically, this could be closed if angular2-materialize were to support that version. Maybe? @rubyboy |
It seems this does not work with
angular2-universal
as it gives a error about thewindow
object not exist.Are there any plans to add support for it?
The text was updated successfully, but these errors were encountered: