Angular2 Observables 映射并立即订阅?

Angular2 Observables map and subscribe at once?

我有一个订阅这样的可观察对象的函数:

public whatever(): Observable<Response> {
  this.someService.functionReturnsObservable(params)
    .subscribe(
      success => {
        /* stuff to be done after observable's next */
      }
    );

  return this.someService.functionReturnsObservable(params)
    .maps((response: Response) => response));
}

这样我调用了函数两次。我试过类似

public whatever(): Observable<Response> {
  return this.someService.functionReturnsObservable(params)
    .map((response: Response) => { 
      /* whatever I put here, even console.log(smthg) does not work */
    });
}

一个可观察对象只有 运行 被订阅。如果它returns一个.map,但没有人订阅它,它永远不会运行 .map。尝试订阅 map.

的结果
public whatever(): Observable<Response> {
  let returnObs = this.someService.functionReturnsObservable(params)
    .map((response: Response) => { 
      console.log('map');
    });

  returnObs.subscribe((response) => {
      console.log('subscribe');
    });

  return returnObs;
}