james
james

Reputation: 169

Meteor dynamically show template the simple way

What is the least code / very simple way to dynamically show a html element "the meteor way"? Jquery.show() is very simple but doesn't work and it seems odd that Meteor way requires lines and lines of code? Any suggestions welcome!

Upvotes: 2

Views: 93

Answers (1)

David Weldon
David Weldon

Reputation: 64312

Use UI.dynamic. There's a really good example of how to do it in this post on creating a simple modal. Here are the relevant snippets:

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

Upvotes: 0

Related Questions