Angular2 RxJS为什么不';t map()工作吗?

Angular2 RxJS为什么不';t map()工作吗?,angular,rxjs,Angular,Rxjs,Angular2HTTP请求返回可观察的。在observable文档中,您可以在observable上使用函数.map() 但是,当我在http observable上使用.map()时,会出现以下错误: argument is not a function. Are you looking for `mapTo()`? .mapTo()似乎提供了一些类似的行为,但我想知道。。。。为什么.map()在这里不起作用 编辑: 谢谢,这里有更多的信息。我正在使用webpack和Angular 2.0

Angular2HTTP请求返回可观察的。在observable文档中,您可以在observable上使用函数
.map()

但是,当我在http observable上使用
.map()
时,会出现以下错误:

argument is not a function. Are you looking for `mapTo()`?
.mapTo()
似乎提供了一些类似的行为,但我想知道。。。。为什么
.map()
在这里不起作用

编辑:

谢谢,这里有更多的信息。我正在使用webpack和Angular 2.0.0-beta.8

缩写的实际代码如下所示:

  import { Observable, map, concatMap, flatMap, reduce, subscribe } from 'rxjs';

  getRequest(endpoint) {
    return this.http.get('https://api.fitbit.com/1/user/-/' + endpoint,
      {
        headers: {
          Authorization: 'Bearer ' +
          localStorage.getItem(this.name + 'AccessToken'),
          'Content-Type': 'application/json'
        }
      }).map(response => response.json());
  }

  var profileRequest = this.getRequest('profile.json');
  var profileRequestLog = profileRequest.map('profile fetched');

请确保
index.html
中包含以下
Rx.min.js
文件

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/2.0.0-beta.9/Rx.min.js">
</script> //CDN reference

我对这方面还不太熟悉,所以不确定我是否能帮上忙。您能否发布一个示例,说明您是如何发出http请求的,以及您使用的angular 2的版本?如果您正确地包含了RxJS,您可以在observable上使用
.map()
。你这样做了吗?您确定它已正确加载和映射吗?显示您的代码和模块配置将使我们更有可能为您指明正确的方向。您能添加一些代码吗?我已经包含了一系列导入,但是否所有这些导入都是必需的?angular2不应该包括相关的RxJS函数吗,比如
map()
?是的,RxJS会添加它,但你必须按照我的方式。导入rxjs/Rx将导入所有Rx操作员。请注意,如果您这样做,您不需要呼叫/导入单个操作员。
import {Observable} from 'rxjs/Observable';
import 'rxjs/Rx';