fix(ngResource): resource instances should be instantiated with the correct instructor function

This fix replaces #5168.

Currently when new resources are instantiated by .get() or .query(), they are instantiated using the Resource 'class' defined in the resourceFactory function.

This causes custom methods and properties defined on the original Resource 'class' to be lost.

This fix makes sure that newly created resource instances are created using the correct constructor so all properties and methods for the Resource 'class' are 'inherited' correctly.

Closes #5168.