mgonto / restangular

AngularJS service to handle Rest API Restful Resources properly and easily
MIT License
7.87k stars 840 forks source link

Add configuration option to use plain() by default #696

Closed pleerock closed 8 years ago

pleerock commented 10 years ago

I like restangular, but there are some features I dislike. I don't like that restangular appends its own methods to the objects and arrays(!). I know this is one of the principle of restangular, but personally I don't think that its a RIGHT principle.

I like new plain() method you've introduced, but I also would like to see the option to configure it to use it by default, e.g. getList, get methods return promise that will contain already a plain object.

mgonto commented 10 years ago

Hey,

Thanks for the report, I do think it makes sense :).

I'll mark it as an enhancement :).

Cheers!

a8m commented 10 years ago

+1

Birowsky commented 10 years ago

Is plain() supposed to return $$hashKey??

flauwekeul commented 10 years ago

:+1:

ncammarata commented 10 years ago

Would really like this, caused me a ton of confusion. One particular issue is that my getList was returning a post property that was overridden by Restangular's post property.

adhsu commented 10 years ago

Agreed. I have tons of plain()'s littering my code.

kdela commented 10 years ago

+1

masscrx commented 10 years ago

+2

nevcos commented 9 years ago

+1

SanthoshMR commented 9 years ago

+1

sornii commented 9 years ago

It could have a feature to only use it in certainly moments, like posting to the server.

wibobm commented 9 years ago

+1

chuckweinberger commented 9 years ago

+1

eventures-io commented 9 years ago

+1

tylercollier commented 9 years ago

:+1:

I've been (minimally) using this library for 6+ months without realizing the 'big idea' of 'restangularization', which is a very cool idea but surprises you when you look at your $http response and it has all these restangular properties bundled in.

I think that fact should be mentioned in a "Critical/Minimum understanding" section of the README, not because the way it works by default is "wrong", but because people like me will miss out on perhaps the coolest part of the project.

nevcos commented 9 years ago

I think that in a MVC application (where there should be a service class responsible for making the CRUD) the "retangularization" doesn't help, instead it creates problems clobbering properties and making debugging more difficult.

I suggest that the "restangularization" should be an option that, If turned off, the object should be clean as it come from the server (without any clobbered properties nor additional methods).

rafaelmotta commented 9 years ago

+1

jebarjonet commented 9 years ago

+1

Would be especially useful when having a bunch of conditions on object size sent from server, currently needs a plain() for each of them.

marcdexet-cnrs commented 9 years ago

+1

Restangular is wonderful but in most of the cases we don't need all the methods. A raw response without unnecessary methods additions will be a very appreciated feature.

danivaan commented 9 years ago

+1

mspoerer commented 9 years ago

+1

lougaou commented 9 years ago

:+1:

zorzysty commented 8 years ago

:100:

agustinjlopez commented 8 years ago

+1

daviesgeek commented 8 years ago

This is addressed in this PR #1184

chillyistkult commented 8 years ago

Would be cool to have this merged as soon as possible.

chorsnell commented 8 years ago

+1

daviesgeek commented 8 years ago

Merged. Will be in a release shortly.

DmitryGonchar commented 8 years ago

@daviesgeek Any chance of the new release?