Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Strip restangular methods from entries #278

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fzaninotto
Copy link
Member

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

.oneUrl(view.entity.name(), this.config.getRouteFor(view, entityId))
.get()
.then(function (response) {
response.data = Restangular.stripRestangular(response.data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can maybe put this in the view.mapEntry method ?

@manuquentin
Copy link
Contributor

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

@fzaninotto
Copy link
Member Author

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
Copy link
Member Author

We can't prevent Restangular from decorating, but we can get the original entity by adding a listener (see mgonto/restangular#100 (comment)). Back to WIP.

@fzaninotto fzaninotto changed the title [RFR] Strip restangular methods from entries [WIP] Strip restangular methods from entries Feb 3, 2015
@fzaninotto
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug with wysiwyg field named "head"
2 participants