give a complete example for resource with angularjs and requirejs