User1277704360 posted
Hi,
Nav.js is a wrapper around History.js that is included when a VS11 SPA project is created.
We create a NavHistory object as follows:
var nav = new NavHistory({
params: { view: 'View1' },
onNavigate: function (navEntry) {
alert("Display" + navEntry.params.view);
}
}
});
nav.initialize({ linkToUrl: true });//Nothing works if set to false
Next we handle a menu click event, which causes the view to change - hence we want to add that to the browser back button history. We do that by calling nav.navigate:
this.onMenuClick = function () {
alert('Menu clicked');
nav.navigate({ view: "View2" });
};
The problem: After the initial page re-load, when the menu item is clicked, we get one alert of "Menu clicked", but 2 alerts of "Display View2".
Can someone please advise on a solution?
Thanks!