Changing API implementation from $http to $resource