由于某些原因,当我在路径中有变量时,pathFor函数不工作。我有一个不同的控制器和路由工作,但不是这个。我不知道为什么,并试图更好地了解pathFor函数的工作原理。MeteorJS铁路由器路径问题
我的路线
this.route('topPublicLinks', {
path: '/:permalinkUser/:permalink/top/:linksLimit?',
layoutTemplate: 'layoutPublic',
controller: TopicPagePublicBestLinksController
});
控制器
TopicPagePublicBestLinksController = TopicPagePublicController.extend({
sort: {votes: -1, submitted: -1, _id: -1},
nextPath: function() {
return Router.routes.topPublicLinks.path({linksLimit: this.limit() + this.increment})
}
});
和pathfor
<a href="{{pathFor 'topPublicLinks'}}" type="button" class="btn btn-white {{activeButtonNav 'top'}}">Top Links</a>