My goal is to have a map on a page where you can click countries. The data below the map will change accordingly with the selected country. I have a listener that is called when a country is clicked. From there I can get a iso code (ex United States = US) that corresponds to an iso code of a country in my MongoDB collection named countries. This is currently my code (part of it) in the isClient() section of my js file.
Router.map(function() {
this.route("countries", {
path: "/countries/:_id",
template: "countriesPage",
data:function() {return {country: Countries.findOne({isoCode: this.params._id})}},
});
});
I attempt to update the URL via the onclick event by using
window.history.pushState("object or string", "Title", event.mapObject.id);
^ id = iso code ^
When this is called the URL changes, but the page does not change. So how could I do this without reloading the page?