backbone.js - Backbone view hierarchies / regions -
i'm struggling understanding how use backbone routers , views. url such as: index.html#/products/list
first call universal view insert basic page scaffolding dom, , display items global logo. call products view, inserts general "product" dom elements. call "list" view, displays list of products.
if like:
var router = backbone.router.extend({ initialize : function() { new headerview({el:"#header"}).render(); },
then initialize
routine called when page first loaded. if clears header, navigating route doesn't redisplay because router exists, , initialize
isn't called again.
i can set route like: "/products/list"/
call function, function needs take care of drawing entire page, code need repeated inside routes, , makes whole thing "upside down".
i've looked @ things marionette, looks sledgehammer crack nut.
finally abandon backbone.router altogether, , have 1 big global view, it's own delegation subviews parsing url, can't correct either!
is there easy way have "hierarchy" of views?
Comments
Post a Comment