Tell Iron Router not to intercept a link

大城市里の小女人 提交于 2019-12-21 17:43:33

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!