commit before changing $http to $resource