Created
May 22, 2015 03:11
-
-
Save kofno/2762bcc615ce7440b7f0 to your computer and use it in GitHub Desktop.
Simple js partial example.
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
$('#the-modal').html('<%=j render('form') %>') | |
$('#the-modal').modal('show') |
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
# This doesn't work | |
Element.expose :modal | |
the_modal = Element['#the-modal'] | |
the_modal.html = j render('form') # this doesn't work... maybe it needs to be processed by erb too? | |
the_modal.modal 'show' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@kofno if you assign the rendered template to an instance variable you should be able to get it in the template, eg.:
You can't mix server side code like
render
into an opal template because it's executed in the client. In fact you can only pass json compatible values to instance variables (string, number etc. are ok, an object is not).