extended example with $resource