single page application - How to setup durandaljs with Areas? -


for life of me can't make durandaljs work areas. i'm developing application multiple mini spas, i'm not sure how set durandaljs work it. wasn't able find online can drive me in right direction. similar question found this one, vague.

my goal separate each spa within it's own folder so:

app --areas ----area1 ------viewmodels ------views ----area2 ------viewmodels ------views 

the router doesn't seem have concept of areas , no matter how map routes 404s when call router.activate('page1'); after mapping router.maproute('page1'); durandal trying /app/viewmodels/page1.js.

changing to:

router.maproute('areas/area1/viewmodels/page1'); router.activate('areas/area1/viewmodels/page1'); 

results in 404 fetching app/viewmodels/areas/area1/viewmodels/page1.js i've tried many other combinations no longer remember , can't seem work.

can please post working example of how setup durandaljs router plugin , multiple mini spas (areas)? link article document suffice.

you can use viewlocator.useconvention - maybe this:

viewlocator.useconvention(                     "areas/area1/viewmodels",                     "areas/area1/views",                     "areas/area1/templates" ); 

one thing realize useconvention() works in conjunction existing require.config paths setting. in other words, if set require.config "viewmodels" , "views" mapped right folders, well.

for example, code snippet above functionally equivalent to:

window.require.config({     paths: {         "viewmodels": "areas/area1/viewmodels",         "views": "areas/area1/views",         "templates": "areas/area1/templates"     }  viewlocator.useconvention("viewmodels", "views", "templates"); 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -