Meteor以简单的方式动态显示模板

时间:2014-09-15 18:03:26

标签: meteor

动态显示html元素的最少代码/非常简单的方法是什么?#34;流星方式"? Jquery.show()非常简单,但不起作用,Meteor方式需要行和代码行似乎很奇怪?欢迎任何建议!

1 个答案:

答案 0 :(得分:0)

使用UI.dynamic。有一个很好的例子,说明如何在this post中创建一个简单的模态。以下是相关摘要:

<template name="modal">  
  {{#if activeModal}}
    <div class="modal">
      {{> UI.dynamic template=activeModal}}
    </div>
  {{/if}}
</template>
Template.modal.helpers({  
  activeModal: function() {
    return Session.get('activeModal');
  }
});
相关问题