-
Notifications
You must be signed in to change notification settings - Fork 839
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
Non-standard id not getting picked up when restangularizingElement #858
Comments
I think this a bug. When the element is restangulazied, it will set the id to the field I'm not sure what would be the best way to solve it, probably reading both fields (the custom one and I will let @mgonto take a look at that. |
Hi, I have looked into this issue, I have been able to manage to get it working but changing a bit of code in rectangular and a bit in the implementation but I think the change would be worth it (please validate and if you like this solution I will implement it). Check the plunkr. The idea is that to replace:
with
This way you don't need to overwrite "getIdFromElem" to allow customize id names, but instead you overwrite (most likely with exactly same code) the new method "getFieldId". Because this method is used in get and set, restangularize it works ok in both cases. As said, if you like this solution, I will implement it and add the pull request. |
This would work for my use case, but I'm not sure if that's inline with the restangular architecture. As a consumer, determining what the difference between getIdFromElem and getFieldId might be quite non-obvious, but maybe not. I can't really say. |
There is a mistake in my explanation, about no requiring changes to the code in the overriden method, as getFieldId should return the name of the id property instead of a value, so if someone has override getIdFromElem and overrides now getFieldId it would need to change to return just the name of the id instead of the value of the id. |
Hi,
I'm having an issue with creating URLs when I use the getIdFromElem override combined with the "one" call. I have a plnkr demonstrating the issue here: http://plnkr.co/edit/7rlD6G?p=preview Any help would be greatly appreciated.
The text was updated successfully, but these errors were encountered: