Reputation: 172
I'm studying Backbone with Marionette and Rails as backend, using screencast and I got stuck with this error:
Uncaught ReferenceError: FooterApp is not defined
My app.js.coffee code:
@Demo = do (Backbone, Marionette) ->
App = new Backbone.Marionette.Application
App.addRegions
headerRegion: "#header-region"
mainRegion: "#main-region"
footerRegion: "#footer-region"
App.addInitializer ->
App.module("FooterApp").start()
#App.execute "footer:show"
App.on "initialize:after", ->
if Backbone.history
Backbone.history.start()
App
footer_app.js.coffee
@Demo.module "FooterApp", (FooterApp, App, Backbone, Marionette, $, _) ->
@startWithParent = false
API =
showFooter: ->
FooterApp.Show.Controller.showFooter()
FooterApp.on "start", ->
API.showFooter()
and show_controller.js.coffee
@Demo.module "FooterApp.Show", (Show, App, Backbone, Marionette, $, _) ->
Show.Controller =
showFooter: ->
console.log 'test'
I spent a lot of time figuring out what is wrong but still have no clue..
Upvotes: 1
Views: 689
Reputation: 71
In your code you haven't initialized your controller at any point, it should read a bit more like this
API =
showFooter: ->
new FooterApp.Show.Controller
and then in your Footer controller you can have an initialize function that would show it
initialize: ->
console.log 'test'
Upvotes: 1