Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 角度4:错误类型错误:无法读取属性';订阅';控制台中未定义的_Angular_Subscribe - Fatal编程技术网

Angular 角度4:错误类型错误:无法读取属性';订阅';控制台中未定义的

Angular 角度4:错误类型错误:无法读取属性';订阅';控制台中未定义的,angular,subscribe,Angular,Subscribe,我犯了一个错误 TypeError:无法读取未定义的属性“subscribe” 服务文件: List(){ return this.http.get(MY JSON URL) .pipe(map(res => { return res; })); } 你能分享一下你的代码吗。虽然你的代码看起来很完美。需要更多的上下文,请在这里发布整个类。这并不是说它能解决任何问题,但你不需要这个管道,因为你没有对List()中的

我犯了一个错误

TypeError:无法读取未定义的属性“subscribe”

服务文件:

 List(){
      return this.http.get(MY JSON URL)
      .pipe(map(res => {
        return res;         
      }));
  }

你能分享一下你的代码吗。虽然你的代码看起来很完美。需要更多的上下文,请在这里发布整个类。这并不是说它能解决任何问题,但你不需要这个管道,因为你没有对
List()
中的结果执行任何操作<代码>返回这个。http.get(…)就足够了
 List(){
      return this.http.get(MY JSON URL)
      .pipe(map(res => {
        return res;         
      }));
  }