ng-admin icon indicating copy to clipboard operation
ng-admin copied to clipboard

[WIP] Strip restangular methods from entries

Open fzaninotto opened this issue 10 years ago • 4 comments

Angular adds its own method to every entity fetched. As they are not namespaced, this has side effects.

I removed them, but I'm not sure we don't use them. @manuquentin, any insight?

Fixes #273

fzaninotto avatar Feb 02 '15 23:02 fzaninotto

Restangular methods aren't used on the object himself, we can remove them

manuquentin avatar Feb 02 '15 23:02 manuquentin

As a matter of fact, my patch doesn't solve #273, because properties named like Restangular methods (like "head") are added then removed, so there is no way to read them. We need a way to prevent Restangular from decorating them in the first place.

fzaninotto avatar Feb 03 '15 06:02 fzaninotto

We can't prevent Restangular from decorating, but we can get the original entity by adding a listener (see https://github.com/mgonto/restangular/issues/100#issuecomment-19174352). Back to WIP.

fzaninotto avatar Feb 03 '15 07:02 fzaninotto

I've fixed the bug, but there are two drawbacks:

  • This breaks all tests using Restangular (long and cumbersome to fix)
  • This slows down the app, as we have to clone all entries in order

So this needs more work.

fzaninotto avatar Feb 03 '15 22:02 fzaninotto