I would like to navigate to a given page from multiple pages/paths and filling out the data on that page go back to the previous page.
So basically I would like to make conditional nagivation depending on page parameters or viewmodel parameters.
Is it possible to do so?
Unfortunately, the guard function's callback do not let me to pass path where to go only the window's location can be set which is not good enough.
So if I go from A to B, the back on B should put me back to A. In case of C is the source, the back on B should put me back to C.
Any idea would be great!
Thank you in advance!
The best way I have found so far is to extend the view model with routing-related observables like:
viewModel.originA = ko.observable( false );
viewModel.originC = ko.observable( false );
and define 2 back button:
a(data-bind="page-href: '../A'") Back
a(data-bind="page-href: '../C'") Back
And in the afterShow function of A and C, I set those observable values.
However, I'm not too happy about this. An eye-disturbing work around.
I really hope to see a more elegant way for this conditional routing. :)