nekken / ng2-fullcalendar

95 stars 47 forks source link

Exception when use #5

Closed Rudde closed 7 years ago

Rudde commented 7 years ago

Hello, I've installed this module according to npm instructions, I have fickered a lot with it to try to get it work without luck. But I did find a very interesting thing.

I used this with .NET Core, and webpack hot replacement. And if I do all the changes and I let hot replacment get injected to the site ng2-fullcalendar works fine, but once I refresh, I get this ugly exception.

An unhandled exception occurred while processing the request.

Exception: Call to Node module failed with error: TypeError: Cannot set property 'fullCalendar' of undefined at C:\Users\Kai\Documents\Projects\aspnetcoreSpa\node_modules\fullcalendar\dist\fullcalendar.js:28:19 at $.fullCalendar.version (C:\Users\Kai\Documents\Projects\aspnetcoreSpa\node_modules\fullcalendar\dist\fullcalendar.js:12:20) at Object. (C:\Users\Kai\Documents\Projects\aspnetcoreSpa\node_modules\fullcalendar\dist\fullcalendar.js:17:3) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object. (C:\Users\Kai\Documents\Projects\aspnetcoreSpa\node_modules\angular2-fullcalendar\src\calendar\calendar.js:13:1) MoveNext

nekken commented 7 years ago

Hi Rudde,

the fullcalendar requires jQuery

Since the error complains about $.fn being undefined it could mean that jQuery is not yet loaded.

hope this helps

Rudde commented 7 years ago

Hello.

jQuery is available, if I so import * as $ from 'jquery'; in a file console.log($.fn.version) works fine. I also don't see $.fn in this error I posted here?

nekken commented 7 years ago

seems to me that the order jQuery is loaded is after fullCalendar.

I don't have much experience with WHR so I will need more time to understand it throughly

Rudde commented 7 years ago

Hello!

I'm terribly sorry. It seems that all the issues have been in relation to .NET Core server-side rendering, witch of cores does not have a window, or localstorage etc.. I had not idea how it was done and it was enabled by default, disabling solved this issue and a bunch of other issues I experience that I taught was related to Angular2 and TypeScript.