1

Normally when you do a .get with a resource, the returned object has a $save method.

$scope.questionDetails=$resource(stepsToFlatten.dataSrc,null,{get:{cache:true}}).get();
//$scope.questionDetails.$save is defined

However, when you set isArray to true, the returned resource does not have a $save method.

$scope.questions=$resource("http://stuff.com",null,{get:{cache:true,isArray:true}}).get();
//$scope.questions.$save is undefined

Is this a design flaw or am I doing something wrong? I have an array of questions and I want to be able to save the array back to the server when the values change. I can do that by breaking up the $resource declaration and the get call but since I don't have to do that when an object is returned, I find that solution kind of hacky.

William Neely
  • 1,923
  • 1
  • 20
  • 23
  • Does the answer to this help? http://stackoverflow.com/questions/15725445/angularjs-resource-not-working-with-an-array-returned-from-a-rest-api – camden_kid May 27 '14 at 18:53
  • @camden_kid: Already looked at that, but thanks. That's just for getting the data (unless I'm missing something) which isn't the issue. – William Neely May 27 '14 at 19:02

0 Answers0