Routing for multi step process [closed]

自作多情 提交于 2019-12-13 11:08:19

问题


Edit: Shortened and clarified the problem.

What's the most practical way to achieve the following in my Meteor app using Iron Router:

  • Condition A - show template A
  • Condition B - show template B
  • otherwise - show template C

for a single URL, so that a user cannot directly enter "/url-a" or "/url-b" or "url-c" to select the view/template explicitly.


回答1:


Given the limited information you've provided, I can't think of anything shorter than the following logic in your route:

if ( A ) this.render('templateA');
else if ( B ) this.render('templateB');
else this.render('templateC');

This assumes that you have a route with a layout and you're rendering a template into that layout.

But given this answer is so trivial I suspect you're asking a different question altogether.



来源:https://stackoverflow.com/questions/32520801/routing-for-multi-step-process

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