Javascript 在Meteor中显示/隐藏模态

Javascript 在Meteor中显示/隐藏模态,javascript,jquery,node.js,twitter-bootstrap,meteor,Javascript,Jquery,Node.js,Twitter Bootstrap,Meteor,如何在Meteor中显示引导模式 从中我可以看出Meteor的方法是使用模板逻辑来显示/隐藏模态 我已经尝试在我的模板中添加模态 <div class="modal fade"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="b

如何在Meteor中显示引导模式

从中我可以看出Meteor的方法是使用模板逻辑来显示/隐藏模态

我已经尝试在我的模板中添加模态

<div class="modal fade">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
          <span class="sr-only">Close</span>
        </button>
        <h4 class="modal-title">Modal title</h4>
      </div>
      <div class="modal-body">
        <p>One fine body&hellip;</p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

&时代;
接近
情态标题
一个好身体&hellip

接近 保存更改
我有一个变量
showmodel
,它决定是否应该显示模态。但我不知道如何以编程方式显示/隐藏模式。

向模式添加id

<div id="myModal" class="modal fade">
$('#myModal').modal('show');
$('#myModal').modal('hide');
关闭模式

<div id="myModal" class="modal fade">
$('#myModal').modal('show');
$('#myModal').modal('hide');


如果你想以流星的方式打开模态

在JS中

模板中

{{#if showModal}}
    <div class="modal fade"> <!-- Use Display block to show the modal by default -->
    ...

{{/if}}
{{#if showmodel}
...
{{/if}

让自己的生活变得轻松,并使用引导流星模式软件包。我用这个,效果很好。

但从我发布的链接来看,它说这是jquery方式,而不是Meteor方式it@JamgreenMeteor way意味着只需在
会话中存储一个变量
,并使用该变量来显示/隐藏模式。我自己使用。手巧的花花公子。