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

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -