Created
June 23, 2011 02:39
-
-
Save mxriverlynn/1041780 to your computer and use it in GitHub Desktop.
render partial to jquery 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
this is a partial. <%= model.value %> |
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
class SomeController < ApplicationController | |
def show | |
@template_model = SomeModel.new(:value => "${value}") | |
end | |
end |
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
<html> | |
<head> | |
<script id="some-template" type="x-jquery-tmpl"> | |
<%= render :partial => "some/partial", :locals => {:model => @template_model} %> | |
</script> | |
<script language="javascript" type="text/javascript"> | |
$("#some-template").tmpl({value: "this is some data"}); | |
</script> | |
</head> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment