bleenco / ng2-datepicker

Angular2 Datepicker Component
http://ng2-datepicker.jankuri.com
MIT License
313 stars 236 forks source link

Not working with Angular 2 Universal #130

Open jmaocanada opened 7 years ago

jmaocanada commented 7 years ago

When load the app, got below error: Exception: Call to Node module failed with error: TypeError: ctorParameters.map is not a function

jkuri commented 7 years ago

Can you provide more info about this please?

jmaocanada commented 7 years ago

I am using ASP.NET Core, developing in Visual Studio 2015 My package.json

{ "name": "Angular2Spa", "version": "0.0.0", "dependencies": { "@angular/common": "2.0.0", "@angular/compiler": "2.0.0", "@angular/core": "2.0.0", "@angular/forms": "2.0.0", "@angular/http": "2.0.0", "@angular/platform-browser": "2.0.0", "@angular/platform-browser-dynamic": "2.0.0", "@angular/platform-server": "2.0.0", "@angular/router": "3.0.0", "@types/node": "^6.0.38", "angular2-platform-node": "^2.1.0-rc.1", "angular2-universal": "^2.1.0-rc.1", "angular2-universal-polyfills": "^2.1.0-rc.1", "aspnet-prerendering": "^1.0.6", "aspnet-webpack": "^1.0.11", "bootstrap": "^3.3.7", "css": "^2.2.1", "css-loader": "^0.25.0", "es6-shim": "^0.35.1", "expose-loader": "^0.7.1", "extract-text-webpack-plugin": "^1.0.1", "file-loader": "^0.9.0", "isomorphic-fetch": "^2.2.1", "jquery": "^2.2.1", "ng2-datepicker": "1.4.7", "ng2-modal": "0.0.24", "preboot": "^4.5.2", "raw-loader": "^0.5.1", "reflect-metadata": "^0.1.9", "rxjs": "5.0.0-beta.12", "style-loader": "^0.13.0", "to-string-loader": "^1.1.5", "ts-loader": "^0.8.2", "typescript": "^2.0.0", "url-loader": "^0.5.7", "webpack": "^1.12.14", "webpack-externals-plugin": "^1.0.0", "webpack-hot-middleware": "^2.10.0", "webpack-merge": "^0.14.1", "zone.js": "^0.6.21" } }

My app.moudule.ts:

import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; import { FormsModule } from '@angular/forms'; import { UniversalModule } from 'angular2-universal'; import { ModalModule } from "ng2-modal"; import { DatePickerModule } from 'ng2-datepicker';

import { AppComponent } from './components/app/app.component' import { NavMenuComponent } from './components/navmenu/navmenu.component'; import { HomeComponent } from './components/home/home.component'; import { FetchDataComponent } from './components/fetchdata/fetchdata.component'; import { CounterComponent } from './components/counter/counter.component'; import { DataEntryComponent } from './components/dataentry/dataentry.component';

@NgModule({ bootstrap: [ AppComponent ], declarations: [ AppComponent, NavMenuComponent, CounterComponent, FetchDataComponent, DataEntryComponent, HomeComponent ], imports: [ UniversalModule, // Must be first import. This automatically imports BrowserModule, HttpModule, and JsonpModule too. FormsModule, ModalModule, DatePickerModule, RouterModule.forRoot([ { path: '', redirectTo: 'home', pathMatch: 'full' }, { path: 'home', component: HomeComponent }, { path: 'counter', component: CounterComponent }, { path: 'fetch-data', component: FetchDataComponent }, { path: 'data-entry', component: DataEntryComponent }, { path: '**', redirectTo: 'home' } ]) ] }) export class AppModule { }

You can see I am using the UniversalModule to do the server-side angular rendering.

The error I see is like this:

An unhandled exception occurred while processing the request.

Exception: Call to Node module failed with error: TypeError: ctorParameters.map is not a function at ReflectionCapabilities.parameters (C:\Projects\Learning\CoreAngular2\Angular2Application1\Angular2Application1\node_modules\@angular\core\bundles\core.umd.js:2118:51) at Reflector.parameters (C:\Projects\Learning\CoreAngular2\Angular2Application1\Angular2Application1\node_modules\@angular\core\bundles\core.umd.js:2319:52) at CompileMetadataResolver.getDependenciesMetadata (C:\Projects\Learning\CoreAngular2\Angular2Application1\Angular2Application1\node_modules\@angular\compiler\bundles\compiler.umd.js:14336:81) at CompileMetadataResolver.getTypeMetadata (C:\Projects\Learning\CoreAngular2\Angular2Application1\Angular2Application1\node_modules\@angular\compiler\bundles\compiler.umd.js:14301:28) at CompileMetadataResolver.getDirectiveMetadata (C:\Projects\Learning\CoreAngular2\Angular2Application1\Angular2Application1\node_modules\@angular\compiler\bundles\compiler.umd.js:14074:30) at C:\Projects\Learning\CoreAngular2\Angular2Application1\Angular2Application1\node_modules\@angular\compiler\bundles\compiler.umd.js:14143:51 at Array.forEach (native) at Object.Call (C:\Projects\Learning\CoreAngular2\Angular2Application1\Angular2Application1\node_modules\es6-shim\es6-shim.js:307:14) at Array.forEach (C:\Projects\Learning\CoreAngular2\Angular2Application1\Angular2Application1\node_modules\es6-shim\es6-shim.js:1313:17) at CompileMetadataResolver.getNgModuleMetadata (C:\Projects\Learning\CoreAngular2\Angular2Application1\Angular2Application1\node_modules\@angular\compiler\bundles\compiler.umd.js:14136:46)

nenad-matic-devtech commented 7 years ago

I have the same problem