错误:检测到无法访问的代码 ionic 3 天气应用

深红

好的,所以我正在关注 ionic 3 上的遍历媒体教程,当我到达创建提供程序的部分时,我收到错误消息,指出在此处检测到无法访问的代码:

.map((res: Response) => res.json() );

它也在打字稿上

找不到名称“地图”您的意思是“地图”吗?

import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import 'rxjs/add/operator/map';

@Injectable()
export class WeatherProvider {
  apiKey = "89cca14f4ffcd27d602ad5e587f8e17f";
  url;

 constructor(public http: HttpClient) {
   console.log('Hello WeatherProvider Provider');
   this.url = "api.openweathermap.org/data/2.5/weather?q=";
 }



 getWeather(city, country){
 return this.http.get(this.url+city+','+country);
   .map((res: Response) => res.json() );
 }

}
番茄酱

中的 return 语句getWeather()使.map()无法访问。您应该使 return 语句成为函数中的最后一条语句。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

无法访问 .catch(function(error) Ionic 3 中的变量

检测到Ionic 3 Android Studio

建立Ionic 3应用程式时发生错误

IONIC 3应用程序无法正确发布JSON

无法生产Ionic-3应用程序

无法在 iPhone 上运行 ionic3 应用程序

无法运行ionic3应用程序

由于更新为[email protected],因此无法构建Ionic3应用程序

由于无法检测到内置的onchange功能,如何在ionic 3中实现最新的屏幕方向?

Android清单应用程序3检测到错误

ionic modal获取错误以打开:ionic 3

Ionic3-ElementRef nativeElement.getElementsByClassName返回集合,但无法访问

如何衡量Ionic 3应用的性能?

ionic 3主题化应用程序

无法合并dex Ionic 3

StackBlitz 中的应用程序错误,Ionic 3 没有提供程序

val.slice不是ionic 3 angular 4应用程序中的函数错误

正确的工作流程可处理Ionic 3应用程序上的401错误

找不到Ionic 3应用程式的'Branch.h'档案Xcode错误

如何修复 Ionic 3 应用程序中缺少的“找不到模块”构建错误

错误:应用脚本服务意外失败。ionic3 中的设置

错误:将terra组件集成到Ionic3应用程序中

谷歌地图错误-ReferenceError:Google在ionic 3应用程序中未定义

Ionic 3-无法在iOS上安装正式版应用

新创建的ionic3应用程序无法在Android设备上运行

Ionic 3:重新启动应用程序后无法收到推送通知

无法在Ionic V5应用上禁用d3 topojson基本地图缩放

Ionic 2转换为Ionic 3:“ ionic build iOS”上的“错误:无法编译程序”

在for循环上检测到无法访问的代码