angularjs - Avoid serialization of properties -
when require add private property object (for view or logic control) submitted rest api latter, valid prefix property $$? tricky in cases when have object list of children , each child requires private property should not sent.
{ name: 'my object', items: [ { name: 'my child', $$editing: true }, { name: 'my other child', $$editing: true } ] }
yes, angularjs $http service uses angular.tojson method default. properties $$ filtered out, because angular uses such properties internally. (e.g. may have seen $$hashkey property, added angular)
you can try:
console.log(angular.tojson({a:1, $$b:2, c: {x:2,$$_y:3}})) results in "{"a":1,"c":{"x":2}}"
Comments
Post a Comment