hottowel - Durandal: Multiple Routes, One ViewModel/View -


i have 3 routes: items/one, items/two, , items/three , they're pointing 'items' vm/view.

in items.js activate function, i'm checking url, , based on that, i'm changing filter:

function activate(r) {         switch (r.routeinfo.url) {             case 'items/one': vm.filtertype(1); break;             case 'items/two': vm.filtertype(2); break;             case 'items/three': vm.filtertype(3); break;         }         return init(); //returns promise     } 

the items view has menu buttons one, two, , three. each button linked action this:

function clickone() {     router.navigateto('#/items/one'); } function clicktwo() {     router.navigateto('#/items/two'); }     function clickthree() {     router.navigateto('#/items/three'); } 

this works , right filter on view. however, i've noticed if i'm on 'one', , go 'two', ko-bound variables update in 'real-time', is, they're changing, , before activate promise resolves, causes transition happen twice (as data being grabbed, , after activate function returns).

this happens in scenario, view , viewmodel same previous one. i'm aware special case, , router handling loading of new route aresameitem = true. split vms/views 3 , try inherit base model, hoping simpler solution.

i able solve issue removing ko bindings before navigation using ko.cleannode() on items containing div.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -