Error 415 unsupported media type angularjs

1,399 views
Skip to first unread message

Edgardo Quiroz

unread,
May 16, 2013, 11:52:45 AM5/16/13
to ang...@googlegroups.com
Hi everybody,

I have a problem with my service, I didn't find how to send a json string as a parameter. My service look like this:

factory('testingManager', function($resource) {
            return $resource('/test/:criteria', {criteria: '@criteria'}, {
                query:{method:'POST', params:{}, isArray:false, headers:{'Content-Type': 'application/json'}}
            });

and the value of criteria is:

$scope.criteria = {name: 'Edgardo', lastName: "Quiroz", age: '19'}
$scope.criteria= angular.toJson($scope.criteria);

I added content-type because I think that can be the problem
can someone know how can I send the json string?

thanks,
Edgardo

Grant Rettke

unread,
May 16, 2013, 1:58:29 PM5/16/13
to ang...@googlegroups.com
What is your measure of success and how does this code fail to achieve
it and in what manner?
> --
> 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 angular+u...@googlegroups.com.
> To post to this group, send email to ang...@googlegroups.com.
> Visit this group at http://groups.google.com/group/angular?hl=en-US.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
Grant Rettke | ACM, AMA, COG, IEEE
gre...@acm.org | http://www.wisdomandwonder.com/
“Wisdom begins in wonder.” --Socrates
((λ (x) (x x)) (λ (x) (x x)))
“Life has become immeasurably better since I have been forced to stop
taking it seriously.” --Thompson
Reply all
Reply to author
Forward
0 new messages