This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
angular.toJson() strips out keys with "$" as the beginning character #5841
Closed
Description
I can understand why angular strips out keys with "$" as the first character when displaying an object so that it can pull out things like $q, when a result is displayed. However, it's recently caused an issue for me when trying to connect to the rest api of Mongolab when trying to send something like
{$push: {tags: {'red'}}}
as the request object. When actually getting sent, the request object comes across as {}
. Keys like $set
and $push
are actually necessary when working with MongoDB. This happens in the toJsonReplacer function which is called within $http
. I can get past this by calling JSON.stringify() myself on the object before sending the request, but I'm wondering if it would be best to disable the stripping of the ${key}
values for $http requests.