Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/390.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/25.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
Javascript OpenWeatherMapAPI到angular ES6_Javascript_Angularjs_Ecmascript 6 - Fatal编程技术网

Javascript OpenWeatherMapAPI到angular ES6

Javascript OpenWeatherMapAPI到angular ES6,javascript,angularjs,ecmascript-6,Javascript,Angularjs,Ecmascript 6,我想在现有项目中实现openweathermaps api,但在添加一些依赖项时遇到了问题 当前项目使用ES6(我认为它是Angular的1.5.x版本),我已经通过BowerAngular openweathermap api工厂模块安装了它 我收到以下错误:ReferenceError:openweathermapFactory未定义 我猜这与“将jtt_openweathermap添加到应用程序的模块依赖项”有关,因为我不知道如何将其添加到ES6项目中 对此有任何帮助吗?似乎使用相同的AP

我想在现有项目中实现openweathermaps api,但在添加一些依赖项时遇到了问题

当前项目使用ES6(我认为它是Angular的1.5.x版本),我已经通过BowerAngular openweathermap api工厂模块安装了它

我收到以下错误:ReferenceError:openweathermapFactory未定义 我猜这与“将jtt_openweathermap添加到应用程序的模块依赖项”有关,因为我不知道如何将其添加到ES6项目中

对此有任何帮助吗?

似乎使用相同的API。这是一个似乎有效的方法

看。注意,在第1行中,作者如何将库作为
jtt_openweathermap
导入到他的角度模块中?具体的代码行如下所示:

angular.module('myApp', ['ui.router', 'ngGeolocation', 'ngProgress', 'ui.router.title', 'jtt_openweathermap', 'ngMap'])

你也需要这样做。我想你可能没有那样做。我还要在这里查看一下,确保您的导入也得到了正确处理。

当我将jtt_openweathermap添加到控制器文件时,我会得到一个空白页面,没有控制台错误:

 angular
.module('panorama', [
  'jtt_openweathermap'
])
.controller('PanoramaCtrl', PanoramaCtrl);

你能分享你的故障代码的代码片段和完整的错误信息吗?事实上,我认为原因是什么,请参阅下面的答案。我使用了http请求并从json中提取数据。现在可以了。如果我有时间,我会尝试使用模块实现它,并在这里发布答案。控制器是否也有适合天气应用程序的导入?请参阅我发布的控制器代码。天气应用程序有一个显式导入。