-
Notifications
You must be signed in to change notification settings - Fork 27.3k
Modify Service Results: Provide 'transformResult' action in ngResource #14381
Conversation
i use TS files to write my model, it was several days already, that i wanted to append an interface to my model, but it always failed and i was wonder why... asking around, searching a lot... but nothing... Yesterday, i wrote a new module that need to check for input parameter type. i saw what it fails... and again searching through code and topics... so at some point i found angular change my model again... seeing what... i told 'transformResponse' to return an object of type AcDocRow, but after steping through i saw, hey waits, it's again an stringified json :| ... Searching searching searching... -lot of people have same issue, it's not only me... -Angular Resource Pass Object to Http.. and it return the value to angular, angular again modify the object.... -lot of conversion from string to object and vice versa. -no solution... what should i do? well let see through the code... and i add ability to add a new action which modify the actual result. and you can bypass transformResponse too. which seem more complicated. it's all seem to be clean... so i hope it be acceptable by the jury. I also it get updated in new version of angular too... I'm capable of filling the doc, but i'm not a native english talker. so i leave it to your hand. i also create pull request in https://github.com/deadmann/code.angularjs.org
|
This PR has two feature changes mixed into one. (ngSwitchBind and something in resource). |
|
well i wanted to keep that ngSwitch for my own self, while i wished to update the transformResult. i'm not much familiar with Git, or TDD(both just a little, and for test even less) as most of small or mid-size compny don't use them. i wished i could do that. i just know some simple TDD in C#, and nothing more. BTW, The bot says all your test are passed. just you return a 'Resource' object, but once user used my Feature, i return his object let say '' instead. BTW if you guide me through the test that should be wroten and it's way for js, and the way of branching. i'll do them all. BTW i use it in production code already with too many data and of many kind. |
|
@deadmann Here's described how you should create feature branches: https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#submitting-a-pull-request Since you already mixed stuff on master, you should create two new branches and then remove commits so that each branch only has commits for one feature: We don't do TDD in angular - we don't write tests before we change code, but we always have a test for each new feature. You can take a look at the resourceSpec.js file to see how tests for resource.js are written. Both git and unit tests are super useful. Btw, can't you use transformResponse for your use case? Why do you need another transformResult? |
i'm using web interface, and i don't know how to log in and also how to move to my repository using batch commands.
tell me the basic, before document, and i'll follow the doc my self |
|
@deadmann I think you should create a new PR once you have sorted out your git situation. Running git on the command line isn't really that hard. Here's one guide for example: http://rogerdudler.github.io/git-guide/ I'm gonna close this PR, since in it's current state, it's not reviewable. You can reopen it once you have sorted out the commits, or simply open a new one. Thanks for your understanding. |
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Feature, As i'm not native english talker, someone should take responsibility to add docs
What is the current behavior? (You can also link to an open issue here)
Caused me lot of trubles.
What is the new behavior (if this is a feature change)?
Fine. (first i though about give item one by one, but i though user may want also grouping and etc, so i give him whole data, and let him transform it wholy)
Does this PR introduce a breaking change?
No.
Please check if the PR fulfills these requirements
Other information:
i use TS files to write my model, it was several days already, that i wanted to append an interface to my model, but it always failed and i was wonder why... asking around, searching a lot... but nothing...
Yesterday, i wrote a new module that need to check for input parameter type. i saw what it fails... and again searching through code and topics... so at some point i found angular change my model again... seeing what... i told 'transformResponse' to return an object of type AcDocRow, but after steping through i saw, hey waits, it's again an stringified json :| ...
Searching searching searching...
-lot of people have same issue, it's not only me...
-Angular Resource Pass Object to Http.. and it return the value to angular, angular again modify the object....
-lot of conversion from string to object and vice versa.
-no solution...
what should i do?
well let see through the code...
and i add ability to add a new action which modify the actual result. and you can bypass transformResponse too. which seem more complicated.
it's all seem to be clean... so i hope it be acceptable by the jury.
I also it get updated in new version of angular too...
I'm capable of filling the doc, but i'm not a native english talker. so i leave it to your hand.
i also create pull request in
https://github.com/deadmann/code.angularjs.org