Angular 2 2.0.0-rc.1类型"Observable< Response>"上不存在属性"map"与问题报告不同 [英] Angular 2 2.0.0-rc.1 Property 'map' does not exist on type 'Observable<Response>' not the same as issue report

查看:77
本文介绍了Angular 2 2.0.0-rc.1类型"Observable< Response>"上不存在属性"map"与问题报告不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

,而这看起来与

这是一个新版本,这些解决方案不适用于该新发布的版本

this is a new version and those solutions don't work for this new released version

我已经更新到最新的Angular 2 rc1,无法编译.我遇到了无法识别"Promise"的问题,最终我直接安装了es6-promise类型来解决该问题.我试过输入各种导入语句,但是没有运气.我正在Visual Studio 2015中运行

I've update to the latest Angular 2 rc1 and can't get things to compile. I had issues with not recognizing 'Promise' I ended up installing es6-promise typing directly to resolve that issue. I have tried putting in various import statements but no luck. I'm running in visual studio 2015

import 'rxjs/Rx';
import {Observable} from 'rxjs/Observable';
import {Observer} from 'rxjs/Observer';
import 'rxjs/add/operator/share';
import 'rxjs/add/operator/map';

return this._http.post(url, null, args).map(extractData).toPromise();

但继续获取类型'Observable'上不存在的属性'map'

but continue to get the property 'map' does not exist on type 'Observable'

我的包裹文件是

"dependencies": {
"@angular/common": "2.0.0-rc.1",
"@angular/compiler": "2.0.0-rc.1",
"@angular/core": "2.0.0-rc.1",
"@angular/http": "2.0.0-rc.1",
"@angular/platform-browser": "2.0.0-rc.1",
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
"@angular/router": "2.0.0-rc.1",
"@angular/router-deprecated": "2.0.0-rc.1",


"systemjs": "0.19.27",
"es6-shim": "^0.35.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12",

"bootstrap": "^3.3.6",
"breeze-client": "~1.5.6",
"handlebars": "^4.0.5"
},
"devDependencies": {
"typescript": "^1.8.10",
"typings": "^0.8.1",
"gulp": "^3.9.1",
"jasmine-core": "~2.4.1",
"karma": "^0.13.22",
"karma-chrome-launcher": "^0.2.3",
"karma-coverage": "^0.5.5",
"remap-istanbul": "^0.6.3",
"karma-jasmine": "^0.3.8",
"karma-jasmine-html-reporter": "^0.2.0",
"http-server": "^0.9.0"
}

推荐答案

您尝试过此导入吗?它对我有用

did you try with this import? it works for me

 import {Observable} from 'rxjs/Rx';
 import 'rxjs/add/operator/map';

这篇关于Angular 2 2.0.0-rc.1类型"Observable< Response>"上不存在属性"map"与问题报告不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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