Meteor Iron Router does not get Current Path from Route

一曲冷凌霜 提交于 2019-12-10 10:44:55

问题


In a Template Helper I get the current path from Iron.Router (iron:router) as follows:

Router.current().route.path(this);

This works fine, unless the route path does contain parameters (e.g. /client/:_id/edit). In that case the path() function returns null.

How do I get the current path within a Template Helper, when the route contains parameters?

There are posts around covering the issue but the solution mentioned there seem not to fit.

I'm using Meteor 1.1.5 with iron:router1.0.7


回答1:


According to this iron-router/issues/289 there are problems when the path contains parameters. The suggestion to use Iron.Location.get().path This works well for me.



来源:https://stackoverflow.com/questions/29741134/meteor-iron-router-does-not-get-current-path-from-route

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