I am making a simple weather app. I am consolidating my logic into a factory, but it is returning nothing. Please help.
var app = angular.module('APP',[]);
app.controller('TheCtrl',function(weatherFetch, $scope, $http){
$http.get('states.json?callback=JSON_CALLBACK').success(function(data){
$scope.states = data
});
$scope.weather = function(s,c){
console.log(weatherFetch.weatherFetch(s,c));
}
})
app.factory('weatherFetch', ['$http', function($http){
return{
weatherFetch : function(s,c){
$http.jsonp('http://api.wunderground.com/api/80ba6707f58c665f/conditions/q/'+s.toUpperCase()+'/'+c.toUpperCase().replace(/ /g,"_")+'.json?callback=JSON_CALLBACK')
.success(function(data){
return data;
}).error(function(err){
return err;
});
}
}
}])