javascript - angular-in-memory-web-api : ctorParameters. 映射不是函数

标签 javascript angular

我正在使用 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/

相关文章:

javascript - 从进行 http 调用的方法返回 promise 的正确方法 (Angular2)

javascript - 如何在 Angular2 中获取(DOM)元素的宽度

Angular 组件命名限制 - 'selector [your component name] is invalid'

javascript - 使用 JavaScript 更新 Wicket 图像

javascript - 带有 Bootstrap 模式和 AJAX 的 Intro.js

html - Angular Material : Custom Form Field Control - move floating label (down)

javascript - Angular 类型 'split' 上不存在属性 'ArrayBuffer'

javascript - 如何在html中输出javascript变量的值?

javascript - & 符号模型可以包含 & 符号集合吗?

javascript - 如何在光标所在的位置插入一些文本?