Skip to content

Instantly share code, notes, and snippets.

View JohnDMathis's full-sized avatar

John Mathis JohnDMathis

  • Leankit
  • Waco, Texas
View GitHub Profile
@JohnDMathis
JohnDMathis / marionette_preloadTemplates.js
Created September 13, 2012 05:07
Preload Marionettejs Templates
Backbone.Marionette.TemplateCache.preloadTemplate = function (templateId, context) {
// preload a single template
var loader = $.Deferred();
var that = this;
var msg;
var err;
if (!templateId || templateId.length == 0) {
err = new Error('No templateId was specified - please provide a valid template id or filename.');
err.name = "NoTemplateSpecified";
throw err;
@JohnDMathis
JohnDMathis / backbone_save_success
Created August 8, 2012 15:49
Backbone save success never fires
//This is my 'Save' handler in a view...
saveRequested: function () {
this.model.save({
success: function () {
put('saved'); <-- never gets here, even when response is 200/OK
this.close();
},
error: function () {
put('error');
}