问题
I'm moving quite a large application to Iron Router. On the client side, all unknown routes are redirected to /404
. In addition, some routes are managed from the server side - for example /static
, that just displays a static page via middleware. The problem is that Iron Router now intercepts all link clicks - so when I click a link to /static
, the action is prevented, browser does not display the server response for that address, and user is redirected to /404
instead.
How do I prevent such behavior? Is there a way to tell Iron Router not to intercept a certain link?
回答1:
You can tell iron router which links it should hook into with the css selector:
IronLocation.configure({
'linkSelector' : 'a[href], a:not([skipir])'
});
Then you could have <a href=".." skipir>Skip this route</a>
来源:https://stackoverflow.com/questions/22311307/tell-iron-router-not-to-intercept-a-link