I am using Durandal 2.0. I have a search and you want to pass the selected item to the detailed view. I know how to pass Id, but since the search in this case has the whole object, I would like to pass the object when navigating. I thought I could use a route with splat, but I'm not sure how to send it when I activate the route.
The route is displayed as:
router.map([ { route: '', title: 'Search', moduleId: 'viewmodels/search', nav: true }, { route: 'create', title: 'Add', moduleId: 'viewmodels/create', nav: true }, { route: 'details*movie', title: 'Details', moduleId: 'viewmodels/details', nav: false }, { route: 'edit', title: 'Edit', moduleId: 'viewmodels/edit', nav: false } ]).buildNavigationModel();
The search view model moves as follows:
var openmovie = function (data) { router.navigate('details*'+ ??what do I do here??); };
And the detailed view model has an activation function:
var activate = function(data) { ???what will the data be??? return true; };
source share