If you call $http() directly on an options object, and you want to send
data (put or post), the data you're sending needs to go into a data:
attribute on the options object.
If, however, you call $http.put(url, options), the options object is sent
as if it were the data: attribute of the $http() options block.
IOW, if you do $http.put(url, {data: {foo: 'baz bar'}}), your endpoint will
receive {data: {foo: 'baz bar'}}, but if you do $http({url: url, method:
'PUT', data: {foo: 'baz bar'}}), your endpoint will receive {foo: 'baz
bar'}. To make things equal, you should instead do a $http.put(url, {foo:
'baz bar'})
That drove me 100% batty, I was getting occasional 400 malformed errors as
Joi was barfing on server-side validation. It also seems to be contrary to
the documentation. (I'm on angular 1.2.20)
e
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.