You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//taking the weather API info and make a service out of it and then I will have the flexibility to use the service somewhere else
weatherApp.service('weatherService', ['$resource', function ($resource) {
this.GetWeather = function (city, days) {
var apiKey = '75ab4a21554c3eea638f0493fc501db1';
var weatherAPI =
$resource("http://api.openweathermap.org/data/2.5/forecast/daily", { callback: "JSON_CALLBACK" }, { get: { method: "JSONP" }});
return weatherAPI.get({ q: city, cnt: days, APPID: apiKey });
};
}]);
_Hope this helps_***
The text was updated successfully, but these errors were encountered:
Hi @shafaiatul, thanks for that suggestion. Yeah, there's plenty of room to modularize the code for different situations. It's currently just serving the needs of the basic project motivation like stated in the README. I'm actually going to enhance this project soon and will take into account how and what kind .service() abstractions will make life easier.
// SERVICES
weatherApp.service('cityService', function() {
});
//taking the weather API info and make a service out of it and then I will have the flexibility to use the service somewhere else
weatherApp.service('weatherService', ['$resource', function ($resource) {
}]);
_Hope this helps_***
The text was updated successfully, but these errors were encountered: