javascript - Remove/delete models from the end of a Backbone.Collection? -


i'm trying remove last 100 models collection. there easy way slice off , remove/delete them or need iterate through them , remove them?

right i'm doing this: (in collection & coffeescript)

for in [@models.length...@models.length-100]   @remove @models[i] 

answer: (in collection & coffeescript)

@remove @slice(-100) 

not sure coffeescript , can use combination of slice , remove

collection.remove(collection.slice(start,end)); 

Comments

Popular posts from this blog

c# - Farseer ContactListener is not working -

Automatically create pages in phpfox -

database - one php page with different contents and urls -