diff options
Diffstat (limited to 'examples/modular-backbone/js/router.js')
-rw-r--r-- | examples/modular-backbone/js/router.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/examples/modular-backbone/js/router.js b/examples/modular-backbone/js/router.js index 9239cb2..3c3973f 100644 --- a/examples/modular-backbone/js/router.js +++ b/examples/modular-backbone/js/router.js @@ -8,6 +8,9 @@ define([ 'views/contributors/ContributorsView', 'views/footer/FooterView' ], function($, _, Backbone, HomeView, ProjectsView, ContributorsView, FooterView) { + + var contributorsView; + var AppRouter = Backbone.Router.extend({ routes: { // Define some URL routes @@ -18,7 +21,9 @@ define([ '*actions': 'defaultAction' } }); + var initialize = function(){ + var app_router = new AppRouter; app_router.on('route:showProjects', function(){ @@ -31,12 +36,15 @@ define([ app_router.on('route:showContributors', function () { + // there is a problem here -- when it draws the first everything is fine + // but when it returns to this view, it adds the items to the list again + // even though the collection has the same number of models + // why won't it empty the divs?! I can do it in the console... + if ( String(contributorsView) !== "undefined" ) contributorsView.clearListView(); + // Like above, call render but know that this view has nested sub views which // handle loading and displaying data from the GitHub API - var contributorsView = new ContributorsView(); - //contributorsView.initialize(); - //contributorsView.render(); - + contributorsView = new ContributorsView(); }); app_router.on('route:defaultAction', function (actions) { |