Skip to content

Instantly share code, notes, and snippets.

@jstrimpel
Created September 23, 2014 23:30
Show Gist options
  • Save jstrimpel/b405db00ccffad3bc182 to your computer and use it in GitHub Desktop.
Save jstrimpel/b405db00ccffad3bc182 to your computer and use it in GitHub Desktop.
lazo: base controller that loads data last when executing an action
// application base controller that resides at app/ctl.js
define(['lazoCtl'], function (LazoCtl) {
'use strict';
return LazoCtl.extend({
index: function (options) {
var self = this;
this.loadModel('model_name', {
success: function (model) {
self.ctx.models.any_name_you_like = model;
options.success('index');
}
});
}
});
});
// use base controller
define(['app/ctl'], function (BaseCtl) {
return BaseCtl.extend({
index: function (options) {
// do whatever you want here then call the base controller
BaseCtl.prototype.index.call(this, options);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment