To process an original request that does not contain a hash, use the empty route that you specified at the bottom of your route list
this.get("", function () { this.app.runRoute("get", "#Home"); });
For normal links on your site to work, that is, links to binary files that AJAX requests do not process, configure your anchor elements using a hash route and parameters as follows (the code uses Razor syntax)
<a href="@Url.Content("#Reporting/Excel/" + Model.Report.Type.ToString() + "/" + Model.Report.Audience.ToString() + "/" + Model.Report.UnitID.ToString() + "/" + Model.Report.DepartmentID.ToString())">Download Excel version</a>
Now create a route for Sammy to send to the actual URL
/* Reporting Excel requests */ this.get("#Reporting/Excel/:type/:audience/:unitID/:departmentID", function () { location.assign("Report/Excel?" + "Type=" + this.params.type + "&" + "Audience=" + this.params.audience + "&" + "UnitID=" + this.params.unitID + "&" + "DepartmentID=" + this.params.departmentID ); });
chrisjsherm
source share