Last active
August 26, 2015 19:29
-
-
Save gentunian/86583be2035600692523 to your computer and use it in GitHub Desktop.
reactive dialogs without extra packages?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template name="dialog"> | |
<div class="modal fade" id="{{dialogId}}"> | |
<div class="modal-dialog"> | |
<div class="modal-content"> | |
<div class="modal-header"> | |
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> | |
<span aria-hidden="true">×</span> | |
</button> | |
<h4 class="modal-title">{{dialogTitle}}</h4> | |
</div> | |
<div class="modal-body"> | |
{{> Template.dynamic template=modalBodyTemplate }} | |
</div> | |
</div> | |
</div> | |
</div> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Blaze.renderWithData(Template.dialog, | |
{ | |
dialogTitle: 'My dialog Title', | |
dialogId: dialogId, | |
modalBody: 'myTemplate' | |
}, | |
$('body').get(0) | |
); | |
Template.dialog.onRendered( function() { | |
$('#dialogId').on('hidden.bs.modal', function (e) { | |
Blaze.remove( Blaze.getView( $('#dialogId').get(0) )); | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment