J
J
John2015-12-23 21:02:00
JavaScript
John, 2015-12-23 21:02:00

Loading data from open sources?

It is necessary to implement the loading of data on the site from third-party resources. In this case, we are talking about a weather widget, and openweathermap.org/current acts as a third-party site. How is Jason data loaded from any remote resource in Angular? For example, locally I do it like this:

$http.get('items/items.json').success(function(data, status, headers, config) {
        $scope.items = data;
    });

Maybe there is an article that describes the creation of something similar. Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
coderisimo, 2015-12-23
@coderisimo

in theory, you need a cross-domain request, for example, to api.openweathermap.org/data/2.5/weather?q=London ,uk&appid=2de143494c0b295cca9337e1e96b00e0 . But, as far as I understand, this is not so easy to do.
anyway you can get information to your server via curl and then give it to your application via standard angular gets )

I
Immortal_pony, 2015-12-24
@Immortal_pony

Use $http.jsonp

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question