我想在现有项目中实现 openweathermaps api,但在添加一些依赖项时遇到问题。
当前项目正在使用 ES6(我认为它是 Angular 的 1.5.x 版本),并且我已通过 Bower Angular-openweathermap-api-factory 模块安装。
我收到此错误:ReferenceError:openweathermapFactory 未定义 我猜它与“将 jtt_openweathermap 添加到应用程序的模块依赖项”有关。因为我不知道如何将它添加到 ES6 项目中。
有什么帮助吗?
最佳答案
This tutorial似乎使用相同的 API。这是 reference implementation这似乎有效。
看看this file 。请注意,在第 1 行中,作者如何将库作为 jtt_openweathermap
导入到他的 Angular 模块中?具体的代码行如下所示:
angular.module('myApp', ['ui.router', 'ngGeolocation', 'ngProgress', 'ui.router.title', 'jtt_openweathermap', 'ngMap'])
你也需要这样做。我想你可能不会这样做。我也会看看这个controller code在这里并确保您的导入也得到正确处理。
关于javascript - openweathermap API 到 Angular ES6,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45190983/