add encapsulation for  ng-resource