Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

toJsonReplacer() patch to support Badgerfish Json format #4526

Closed
wants to merge 1 commit into from
Closed

toJsonReplacer() patch to support Badgerfish Json format #4526

wants to merge 1 commit into from

Conversation

RomanManz
Copy link

Hello,

some strange backends, like ours, may accept only Badgerfish Json format which expects text leave nodes to be sent with a single '$' key, ref: http://badgerfish.ning.com.
I have seen toJsonReplacer() has been changed from rc2 to rc3 in a way which makes it ease to get it working (by adding the key length as qualification), this is a patch that introduces the change:
--- angular.js 2013-10-18 07:06:34.000000000 +0000
+++ angular.js.patched 2013-10-18 07:03:29.000000000 +0000
@@ -888,7 +888,7 @@
function toJsonReplacer(key, value) {
var val = value;

if (typeof key === 'string' && key.charAt(0) === '$') {
if (typeof key === 'string' && key.length > 1 && key.charAt(0) === '$') { val = undefined; } else if (isWindow(value)) { val = '$WINDOW';
Would it be possible to make it in the stable path?
Many thanks in any case!

Best regards
Roman

@mary-poppins
Copy link

Thanks for the PR!

  • Contributor signed CLA now or in the past
    • If you just signed, leave a comment here with your real name
  • PR's commit messages follow the commit message format

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

@petebacondarwin
Copy link
Contributor

@RomanManz - Thanks for sending in this PR. This patch seems a little specific to your needs. In #1463 there has been considerable discussion of an appropriate more general solution - possibly involving whitelisting of properties not to move. In the meantime you can work around this by manually converting your objects to JSON yourself before passing them to the $http service: see #1463 (comment)

@petebacondarwin
Copy link
Contributor

Closing as this fix is too specific.

@RomanManz
Copy link
Author

Hello Pete,

thanks for your help, will follow your advice and also look into 1463.

Best regards
Roman

On Wed, Oct 23, 2013 at 12:31 PM, Pete Bacon Darwin <
[email protected]> wrote:

@RomanManz https://github.com/RomanManz - Thanks for sending in this
PR. This patch seems a little specific to your needs. In #1463https://github.com/angular/angular.js/issues/1463there has been considerable discussion of an appropriate more general
solution - possibly involving whitelisting of properties not to move. In
the meantime you can work around this by manually converting your objects
to JSON yourself before passing them to the $http service: see #1463
(comment)#1463 (comment)


Reply to this email directly or view it on GitHubhttps://github.com//pull/4526#issuecomment-26894646
.

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

Successfully merging this pull request may close these issues.

3 participants