routing - Marionette AppRouter is not firing -


i'm refactoring app , router won't respond. feel might have sequence of events. thats guess. ideas?

init.js

define(function(require) {     'use strict';     var app = (require('app')()),         backbone = require('backbone');     app.modules = {};     require('modules/main/main');     app.on('initialize:after', function() {         if (backbone.history) {             backbone.history.start();         }     });     app.start(); }); 

modules/main/main.js

define(function(require) {     'use strict';     var app = (require('app')()),         maincontroller = require('widgets/main/controller');     app.addinitializer(function() {         app.modules.main = new maincontroller();     }); }); 

widgets/main/controller.js

define(function(require) {     'use strict';     var app = (require('app')()),         marionette = require('marionette'),         view = require('./view');     return marionette.controller.extend({         initialize: function(options) {             this.router = new marionette.approuter.extend({                 approutes: {'apps': 'showapp'},                 controller:             });         },         showapp: function() {             console.log('route fired!');         }     }); }); 

i think problem in many async require requests. i'd try change files main.js in example.

`

define(['app','widgets/main/controller'], function(app, ctr){      app.addinitializer(function() {         app.modules.main = new ctr;     });  }); 

`


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -