I follow an angular tutorial and because the link that I have to use in my service changed since the tutorial was made, I am confuse how to use the second param in params, which is the appid required now by the api.openweathermap.org.
function weatherFactory($http) {
return {
getWeather: function(city, country) {
var query = city + ', ' + country;
var key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
return $http.get('http://api.openweathermap.org/data/2.5/weather?', {
params: {
q: query,
appid: key
}
}).then(function(response) {
// //then() returns a promise which
// is resolved with return value of success callback
return response.data.weather[0].description;
});
}
};
}
The link should look like this:
http://samples.openweathermap.org/data/2.5/weather?q=London,uk&appid=b1b15e88fa797225412429c1c50c122a1
So I put the key like the second params in get, but I don't know how to add this & in front of appid, to be like in the link example from them. Can someone please tell me how to do it?