http://stackoverflow.com/questions/12132947/change-default-delimiters-in-ember-js/14697027#14697027



If you don't want to change any delimiters (on web2py or in 
handlebars<http://handlebarsjs.com/>) 
you can do it by saving the handlebars template in an external file like *
people.hbs* in the web2py /static/ folder for example

{{#each people}}<div class="person">
    <h2>{{first_name}} {{last_name}}</h2></div>{{/each}}

And in the view import that file using jQuery load() 
function<http://api.jquery.com/load/>
.

<script 
src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js";></script><script
 
src="https://raw.github.com/wycats/handlebars.js/master/dist/handlebars.js";></script>
    
<div id="list"></div><script id="people-template" 
type="text/x-handlebars-template"></script>
<script type="text/javascript">
$('#people-template').load('/static/people.hbs', function() {
    var template = Handlebars.compile($("#people-template").html());
    var data = {
        people: [
            { first_name: "Alan", last_name: "Johnson" },
            { first_name: "Allison", last_name: "House" },
        ]
    };
    $('#list').html(template(data));});</script>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to