javascript - How to render only required files in backbone router -


  • i have written backbone router , it's working fine.
  • for first time when it's load, files given in router define method getting called.
  • but want specific page load files loaded, whether first time or second time...
  • if removed rest of view files not loaded, how create instances other views , have define them.

is there way solve this. please help.

this how router coded:

define([     'jquery',     'underscore',     'backbone',     'landingview',     'pdpview'  ], function($, _, backbone,landingview, pdpview) {      var approuter = backbone.router.extend({         routes: {             'landing': 'landingview',             'pdp': 'pdp',             '*actions': 'default'         }      });      var initialize = function(){         var a_router = new approuter;          a_router.on('route:landing', function(){             var landingview = new landingview();             landingview.render();         });          a_router.on('route:pdp', function(){             var pdpview = new pdpview();             pdpview.render();         });          a_router.on('route:default', function(){             var landingview = new landingview();             landingview.render();         });          backbone.history.start();     };     return {         initialize: initialize     }; }); 


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -