Javascript Meteor中具有自定义路径的引导模式

Javascript Meteor中具有自定义路径的引导模式,javascript,twitter-bootstrap,meteor,modal-dialog,router,Javascript,Twitter Bootstrap,Meteor,Modal Dialog,Router,我想在模式中显示用户设置,并显示url,以显示/settings/ 不知道如何设置它。它是在路由器设置中完成的,还是在设置链接上的单击事件中完成的 我有header.html: <!-- nav stuff --> <li><a href="{{pathFor 'userSettings'}}" >Settings</a></li> <template name="userSettings"> <div clas

我想在模式中显示用户设置,并显示url,以显示
/settings/

不知道如何设置它。它是在路由器设置中完成的,还是在设置链接上的单击事件中完成的

我有
header.html

<!-- nav stuff -->
<li><a href="{{pathFor 'userSettings'}}" >Settings</a></li>
<template name="userSettings">
  <div class="modal fade" id="userModal">
    <!-- Stuff -->
  </div>
</template>
userSettings.html

<!-- nav stuff -->
<li><a href="{{pathFor 'userSettings'}}" >Settings</a></li>
<template name="userSettings">
  <div class="modal fade" id="userModal">
    <!-- Stuff -->
  </div>
</template>

我会做一些类似于图中所示的事情,并做一些修改:

1。为设置创建路由:

this.route('settings', {path: '/settings'});
<template name="settings">
  {{> projectImageItem}}
  {{> projectImageModal}}
</template>

<!-- A modal that contains the bigger view of the image selected -->
<template name="projectImageModal">
  <div class="modal fade in" id="projectImageModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
          <h4 class="modal-title">Big Image</h4>
        </div>
        <div class="modal-body">
          <img src="{{cfsFileUrl 'bigProjectImage' file=image}}" alt="..." class="img-rounded">
        </div>
      </div>
    </div>
  </div>
2。为该路线创建模板,例如在client/views/settings.html下

3。将模板放入该文件中,但请注意,对ProjectMageItem和ProjectMageModel的调用不在正文中,而是在设置模板中:

this.route('settings', {path: '/settings'});
<template name="settings">
  {{> projectImageItem}}
  {{> projectImageModal}}
</template>

<!-- A modal that contains the bigger view of the image selected -->
<template name="projectImageModal">
  <div class="modal fade in" id="projectImageModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
          <h4 class="modal-title">Big Image</h4>
        </div>
        <div class="modal-body">
          <img src="{{cfsFileUrl 'bigProjectImage' file=image}}" alt="..." class="img-rounded">
        </div>
      </div>
    </div>
  </div>

你有机会尝试我的答案吗?@ChipCastle不起作用:(它在我这边起作用了,现在我看到你编辑了源代码。我会看看我能用你当前的源代码做些什么。@ChipCastle谢谢!就像我说的,我希望模态能弹出,比如说我的
/
页面内容和url改成
/settings
,这样就不会有混乱了是的,我认为这有点不寻常,因为模态是哦,模板需要呈现。所以我认为你应该有一个重定向到传统设置页面(没有模式)的路由,或者简单地单击一个打开模式的链接-不是两者都有。换句话说,当你看不到后面的内容时,为什么要改为另一个路由/页面,因为模式将覆盖在上面?