gpt4 book ai didi

Angular2 - http.post(...).map 不是函数

转载 作者:太空狗 更新时间:2023-10-29 17:01:24 24 4
gpt4 key购买 nike

<分区>

我已经查看了所有 github 问题和 StackOverflow 帖子,但我无法让它工作

( https://github.com/angular/angular/issues/5632 )

( Angular 2 HTTP GET with TypeScript error http.get(...).map is not a function in [null] )

  • 我正在使用 Angular2@2.0.0-beta.1
  • 当我在控制台中检查控制台/资源时,Rxjs (rxjs@5.0.0-beta.1) 已成功导入。

我尝试了不同的导入:

import 'rxjs/add/operator/map';

导入 'rxjs/rx';

但是我一直报错http.post(...).map 不是函数

更新 - 代码上下文

let body = "email=" + email + "&password=" + password;
let headers = new Headers();
headers.append('Content-Type', 'application/x-www-from-urlencoded');
this.http.post('http://angular.app/api/v1/auth') // angular.app is laravel backend
.map( (responseData) => {
return responseData.json();
})

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com