Skip to content

Instantly share code, notes, and snippets.

@squallstar
Last active November 27, 2015 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save squallstar/0a33a4f7a7ef5b1a2f40 to your computer and use it in GitHub Desktop.
Save squallstar/0a33a4f7a7ef5b1a2f40 to your computer and use it in GitHub Desktop.
bb collection
var Beacon = Backbone.Model.extend({
defaults: {
name: String
}
});
var Beacons = Backbone.Collection.extends({
model: Beacon,
url: '/beacons'
});
var beacons = new Beacons();
beacons.on('add', function (beacon) {
$('.results').append(_.template('beacon', beacon));
});
beacons.fetch();
<template name="beacon">
<beacon>{{name}}</beacon>
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment