Communicating with a server using a service and $resource