angular-in-memory-web-api:ctorParameters.map不是一个函数 [英] angular-in-memory-web-api: ctorParameters.map is not a function

查看:98
本文介绍了angular-in-memory-web-api:ctorParameters.map不是一个函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Angular2 In-Memrory API的0.1.17以及Angular CLI(使用Webpack)。我从 HTTP教程中逐字逐句地了解了所有步骤我收到以下错误:

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)

这是我的app.module.js导入:

Here is my app.module.js imports:

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

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


推荐答案

看来,您的版本不匹配。您正在使用的角度版本希望ctorParameters是一个数组。但是在InMemoryWebApiModule v0.1.17中提供了一个功能。升级到v0.2.0。在这个版本中提供了一个数组。

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.

这篇关于angular-in-memory-web-api:ctorParameters.map不是一个函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆