Skip to content

@MeoMix /gist:6ee36e30ea0e9c140ee3 secret
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
// Convert data which is sent from the server back to a proper Backbone.Model.
// Need to recreate submodels as Backbone.Models else they will just be regular Objects.
parse: function (data) {
if (data.items.length > 0) {
// Reset will load the server's response into items as a Backbone.Collection
this.get('items').reset(data.items);
} else {
this.set('items', new PlaylistItems());
}
// Remove so parse doesn't set and overwrite instance after parse returns.
delete data.items;
return data;
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.