Last active
August 29, 2015 14:05
-
-
Save jstrimpel/ce9e91952745834ab050 to your computer and use it in GitHub Desktop.
lazo base controller and sessions model example
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
// base controller | |
define(['lazoCtl'], function (Ctl) { | |
'use strict'; | |
return Ctl.extend({ | |
index: function (options) { | |
this.loadModel('session', { | |
success: function (model) { | |
this.ctx.models.session = model; | |
// the extended controller could set a property | |
// enabling you to call any view from the base | |
options.success(this.action || 'index'); | |
}, | |
error: function (options) { | |
// handle error | |
} | |
}); | |
} | |
}); | |
}); | |
// extend base controller | |
// you could use another controller or the lazo | |
// base controller; the main point is that | |
// you eventually call BaseCtl.prototype.index | |
define(['app/baseCtl'], function (BaseCtl) { | |
'use strict'; | |
return BaseCtl.extend({ | |
index: function (options) { | |
// execute code specific to this controller | |
// then call base controller index action | |
BaseCtl.prototype.index.call(this, options); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment