javascript

I'm using 0.1.17 of the Angular2 In-Memrory API along with the Angular CLI (with Webpack). I followed all the steps verbatim from the HTTP tutorial and I'm getting the following error:

reflection_capabilities.js:58 Uncaught TypeError: ctorParameters.map is not a function
    at ReflectionCapabilities.parameters (http://localhost:4200/main.bundle.js:48626:45)

Here is my app.module.js imports:

imports: [
    BrowserModule,
    FormsModule,
    HttpModule,
    AppRoutingModule,
    SharedModule,
    CoreModule,

    // Fake API -- remove for production
    InMemoryWebApiModule.forRoot(InMemoryDataService)
  ],

It seems, that your versions don't match. The angular version you are using wants ctorParameters to be an array. But in InMemoryWebApiModule v0.1.17 there is a function provided. Upgrade to v0.2.0. In this version an array is provided.


This bug seems to be linked to some package expecting the version of Angular core to be different than what is actually installed.

I was able to figure out the cause of this issue by looking at the error report from ng build :

npm WARN @angular/platform-server@2.4.4 requires a peer of @angular/core@2.4.4 but none was installed.

This helped me realize that one of my packages expected Angular to be at v2.4.4, but I'm using v2.0.1. I updated my package.json to have both packages set to my core version like this:

"dependencies": {
    "@angular/core": "2.0.1",
    "@angular/platform-server": "2.0.1",
}

Your issue might not be with @angular/platform-server, but I hope this helps debug it


当您在参数赋值中将错误的符号放入模板==而不是=时,会引发此错误。

链接地址: http://www.djcxy.com/p/94276.html

上一篇: Mypy / Pandas的分类存根

下一篇: JavaScript的