Created
September 23, 2014 23:30
-
-
Save jstrimpel/b405db00ccffad3bc182 to your computer and use it in GitHub Desktop.
lazo: base controller that loads data last when executing an action
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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