I have one single-page application with three sub-pages.
Url structure is:
/page (sub-page-0)
/page#sub-page-1
/page#sub-page-2
View Model is:
function ViewModel(activePage){
var self=this;
self.activePage=ko.observable(activePage);
self.changePage=function (newPage){
self.activePage(newPage);
//change url
});
}
When user enter url I want to get # part in javascript and construct ViewModel with this parameter.
When user click link in the page I want to change URL and load that sub page.