Skip to content

Instantly share code, notes, and snippets.

@TechnotronicOz
Created February 26, 2013 23:33
Show Gist options
  • Save TechnotronicOz/5043389 to your computer and use it in GitHub Desktop.
Save TechnotronicOz/5043389 to your computer and use it in GitHub Desktop.
Backbone Router
class hawk.router extends Backbone.Router
routes:
'': 'default'
'contact': 'openContact'
'work': 'openWork'
'work/:id': 'openProject'
'about': 'openAbout'
openContact: ->
console.log 'openContact'
openWork: ->
console.log 'openWork'
openProject: (id) ->
console.log 'openProject: ' + id
openAbout: ->
console.log 'openAbout'
default: ->
console.log 'default'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment