an example of how to use $resource of angular