Skip to content

Instantly share code, notes, and snippets.

@rbpasker
Created February 5, 2013 18:56
Show Gist options
  • Save rbpasker/4716707 to your computer and use it in GitHub Desktop.
Save rbpasker/4716707 to your computer and use it in GitHub Desktop.
Backbone.Cloudant.database = "/sandbox/";
// start the change handler
// Backbone.Cloudant.changeHandler();
PersonView = Backbone.View.extend({
initialize: function () {
this.render();
},
template: _.template($("#person_template").html()),
render: function() {
this.$el.html(this.template(this.model.attributes));
return this;
}
}
);
var all_docs = new Backbone.Cloudant.Docs.Collection();
var all_docs_view = new PersonView({collection: all_docs, id: '#person_template'});
all_docs.fetch().fail(function(){console.log('Could not load all_docs collection');});
<script src="jquery/jquery-1.9.0.full.js"></script>
<script src="underscore/underscore-1.4.4.full.js"></script>
<script src="backbone/backbone-0.9.10.full.js"></script>
<script src="cloudant/backbone.cloudant-0.0.1.full.js"></script>
<script type="text/template" id="person_template">
<input type="text" id="id" />
</script>
HELLOW WORLD
<div id="person_container"></div>
<script src="js/app2.js"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment