Skip to content

Instantly share code, notes, and snippets.

@sohara
Created December 20, 2011 22:23
Show Gist options
  • Save sohara/1503563 to your computer and use it in GitHub Desktop.
Save sohara/1503563 to your computer and use it in GitHub Desktop.
Backbone router example
class Quizback.Routers.TestSessions extends Backbone.Router
routes:
"": "index"
"questions/:id": "showQuestion"
index: () ->
@test_session = new Quizback.Models.TestSession()
@test_view = new Quizback.Views.TestSessionView({model: @test_session})
showQuestion: (questionId) ->
question = Quizback.questions.get(questionId)
@test_view.nextQuestion(question.id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment