@ramos1992 wrote:
Hello guys, I need your help
First off all i´m creating a WeatherApp but i´ve geting into some issues.
I am using yahoo weather api, i can extract some information from the json file, but when i try to extract the tag forecast i have issues. can you help me?//this how i extract the informations and its sucessful
obj.wheather = function(city) {
var api = "https://query.yahooapis.com/v1/public/yql?q=";
var query = "select * from weather.forecast where woeid in (select woeid from geo.places(1) where text='" + city + "')";
var params = "&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys";
var cb = "&callback=JSON_CALLBACK";
return $http.jsonp(api + escape(query) + params + cb);
};
return obj
})WeatherApi.wheather(city).success(function(data) {
$scope.data = data; --successfull extraction $scope.condition = data.query.results.channel.item.condition.text; --successfull extraction $scope.conditionCode = $scope.getCode(data.query.results.channel.item.condition.code); --successfull extraction $scope.temp = data.query.results.channel.item.condition.temp; --successfull extraction $scope.unit = data.query.results.channel.units.temperature; --successfull extraction var kevin = "0"; or var kevin = 0; i've try this two things $scope.conditionCode2 = data.query.results.channel.item.forecast.kevin.code; -- i can't get the information because the tag of json is a number ? $scope.conditionCode2 = data.query.results.channel.item.forecast.0.code; -- i can't get the information because the tag of json is a number ? $scope.$apply(); });
});
for a better look of the json file here is the link https://developer.yahoo.com/yql/console/#h=select+*+from+weather.forecast+where+woeid%3D2502265
Posts: 1
Participants: 1