Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angular-in-memory-web-api: ctorParameters.map is not a function

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)
  ],
like image 789
Jon Gunter Avatar asked Dec 12 '16 19:12

Jon Gunter


1 Answers

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.

like image 191
mbhr Avatar answered Sep 28 '22 14:09

mbhr