Replace $http with $resource