pfried pfried - 10 months ago 44
AngularJS Question

Restangular inserting models to collection after post

I am inserting a model in a restangular collection with post

var collectionService = restAngular.all('collection');
var collection = collectionService.getList();

var item = {
title : "A title"

Now i could do instead of the last statement: {

Why is the inserted model not inserted into the collection by default? Is there a reason for this? Am i missing a call or something? I would like to avoid fetching the collection again after i inserted the model


From the docs

Try"push", newItem);

Also, make sure that newItem is really being returned correctly.