How can I use $resource.get() params correctly or $http.get()

I followed an angular tutorial that uses for the weather app lesson. Because doesn’t have anymore weather data more than 1 day, I found another website that allows you to have weather data for free more than 1 day.

The problem is that I can’t figure out how to implement the new demo link in the tutorial link, inside $resource.get().

Code for

With $resource

$scope.weatherAPI = $resource("");
$scope.key = 'sdfdfdsfdsfsdfrtrt';
$scope.weatherResult = $scope.weatherAPI.get({q: $, appid: $scope.key});

With $http:

var query = city + ', ' + country;
$http.get('', {
	params: {
		q: query,
		appid: key


New link from

My issue is that in openweathermap after ? you can use your params easy, but on wunderground you have a lot of / / to separate the params.

Can someone please tell me how to implement this second link in $resource or $http?

Hi sorin21us, I haven’t used API wunderground before but it looks like all the information is in the url. So rather than append query string parameters, you need to manually put the URL together.

In your $http example:

var normalisedCity = $' ', '_');
var url = '' + $scope.key + '/forecast/q/' + $ + '/' + normalisedCity + '.json';

and then use the url in your $http call.


Hope that helps, happy to answer any questions :slight_smile:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.