我正在使用 Angular2 In-Memrory API 的 0.1.17 以及 Angular CLI(带有 Webpack)。我逐字按照 HTTP tutorial 中的所有步骤进行操作我收到以下错误:
reflection_capabilities.js:58 Uncaught TypeError: ctorParameters.map is not a function
at ReflectionCapabilities.parameters (http://localhost:4200/main.bundle.js:48626:45)
这是我的 app.module.js 导入:
imports: [
BrowserModule,
FormsModule,
HttpModule,
AppRoutingModule,
SharedModule,
CoreModule,
// Fake API -- remove for production
InMemoryWebApiModule.forRoot(InMemoryDataService)
],
最佳答案
看来,您的版本不匹配。您使用的 Angular 版本希望 ctorParameters 成为一个数组。但是在 InMemoryWebApiModule v0.1.17 中提供了一个函数。升级到 v0.2.0。在这个版本中提供了一个数组。
关于javascript - angular-in-memory-web-api : ctorParameters. 映射不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41107962/