Skip to content

Instantly share code, notes, and snippets.

@plasticut
Last active August 29, 2015 14:04
Show Gist options
  • Save plasticut/f0eb4fe7b89f936abbac to your computer and use it in GitHub Desktop.
Save plasticut/f0eb4fe7b89f936abbac to your computer and use it in GitHub Desktop.
get model from element context
Comp.prototype.onClick = function(ev, el) {
var item = this.model.root.at(el.$bindStart.context.expression.pathSegments(el.$bindStart.context).join('.'));
};
////
app.on('model', function(model) {
model.fromEl = function(el) {
var ctx = el.$bindStart.context;
return this.at(ctx.expression.pathSegments(ctx).join('.'));
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment