Skip to content

Instantly share code, notes, and snippets.

@supasympa
Created December 13, 2013 11:45
Show Gist options
  • Save supasympa/7943159 to your computer and use it in GitHub Desktop.
Save supasympa/7943159 to your computer and use it in GitHub Desktop.
click proxy for backbone
//<a href="#/my/application/route" rel="" data-forproxy="{myproxy:data}">Some link</a>
var someView = {
events : {
'click a[rel="proxy"]' : clickProxy
},
clickProxy : function(e){
var $anc, proxyData, route;
$anc = $(e.target());
proxyData = $anc.attr('data-forproxy');
route = $anc.attr('href').replace('#','');
app.route(route, {trigger:true});
return;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment