openweathermap API到角度ES6

时间:2017-07-19 12:42:50

标签: javascript angularjs ecmascript-6

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

当前项目正在使用ES6(我认为它是Angular的1.5.x版本),我已经通过bower angular-openweathermap-api-factory模块安装。

我收到此错误:ReferenceError:未定义openweathermapFactory 我想这与“将jtt_openweathermap添加到应用程序的模块依赖项”有关。因为我不确定如何将它添加到ES6项目中。

对此有何帮助?

2 个答案:

答案 0 :(得分:1)

This tutorial似乎使用相同的API。这是一个似乎有用的reference implementation

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

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

你也需要这样做。我想你可能不是那样做的。我还会在这里看一下这个controller code,并确保你的导入也能正确处理。

答案 1 :(得分:0)

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

class Reader(object):
     # a Python object that can load data and have some intelligence, not related to TF, initialized with batch_sized

    def read_up_to(self):
        """Reads up to batch_size elements loaded in Python"""

def input_fn():
    reader = Reader() # instantiated once
    return tf.py_func(reader.read_up_to, inp=[], Tout=...)
相关问题