change $http to $resource