Skip to content

Instantly share code, notes, and snippets.

@workmaster2n
Created January 28, 2015 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save workmaster2n/7d1648ea799e4fee0292 to your computer and use it in GitHub Desktop.
Save workmaster2n/7d1648ea799e4fee0292 to your computer and use it in GitHub Desktop.
routing issue
@App = do(Backbone, Marionette) ->
App = new Marionette.Application
App.on "initialize:after", ->
if Backbone.history
Backbone.history.start(pushState: true)
App
@App.start()
@App.module "LocationApp", (LocationApp, App, Backbone, Marionette, $, _) ->
class LocationApp.Router extends Marionette.AppRouter
appRoutes:
"locations/:id" : "showLocation"
API =
showLocation: (id)->
alert "mar works"
# LocationApp.Show.Controller.showLocation(id)
App.addInitializer ->
new LocationApp.Router
controller: API
@trezy
Copy link

trezy commented Jan 29, 2015

Here's my App file:

  class App extends Marionette.Application
    channel: Backbone.Radio.channel 'application'

    config: {}

    onStart: ->
      Backbone.history.start pushState: true

And here's my index file:

  # Attach our application object to the window for easy access
  window.app = app = new App

  # Initialize the router
  app.router = new Router

  # Attach all of our views to the application object
  app.rootView = new RootView

  # Start the application
  app.start()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment