devmingle
Home
Categories
Popular Codes
Articles
/
Javascript
/
Backbone
/
Backbone js
Backbone js
Backbone js
var ships = new Backbone.Collection; ships.on("add", function(ship) { alert("Ahoy " + ship.get("name") + "!"); }); ships.add([ {name: "kjnFlying Dutchman"}, {name: "Black Pearl"} ]);
1
Source:
backbonejs.org
Backbone js event listener
var ViewName = Backbone.View.extend({ initialize: function(){ this.$el.on("eventName", this.functionName, this) }, functionName: function(){ //whatever }, remove: function() { this.$el.off("eventName", this.functionName); Backbone.View.prototype.remove.apply(this, arguments); } });
0
Source:
stackoverflow.com
Share
Similar codes
0 vote
183 views
1 answer
Backbone model save without validation
Javascript
Backbone
39 votes
182 views
2 answers
Backbone js event listener
Javascript
Backbone
Share