angular-restmod icon indicating copy to clipboard operation
angular-restmod copied to clipboard

Search not returns Instances. Returns Json Objects

Open joseglego opened this issue 9 years ago • 1 comments

I was working with this lib. And following the example in the documentation. I'm doing:

Bike.$search({ brand: 'Trek' })

The return is ok, a list with all possible bikes with the brand. But, what happen now If I wanna modify each element of the list and update it?. The return is just a list of Json Objects. But I think it must return a List of instances of Bikes instances.

  • If I try with Bike.$build() it will do a new instance, and then Bike.$save().
  • But if I try with Bike.$find() for each instance of the list is not elegant and efficient.

I think the $save() can evaluate if the Instance have an Id and do an UPDATE or if have not id do a POST. Or the list must be a list of Bikes instances.

joseglego avatar Jun 27 '16 21:06 joseglego

The result of Bike.$search({brand: 'Trek'}) should be a restmod Collection. A Collection contains individual instances of Bike. What does more of your code look like?

jpulec avatar Sep 22 '16 01:09 jpulec