jquery-tmpl icon indicating copy to clipboard operation
jquery-tmpl copied to clipboard

Updated: Template composition fails with compiled templates

Open pagles opened this issue 14 years ago • 1 comments

This is an update to closed issue #52 I have mofified the example of "Example: Using {{tmpl}} to render hierarchical data." in http://api.jquery.com/template-tag-tmpl/ to highlight the issue:

test.html

<table><tbody><tr><th>Title</th><th>Languages</th></tr></tbody>
<tbody id="movieList"></tbody></table>
<button id="foreignBtn">Foreign</button>
<button id="dramaBtn">Drama</button>

</body>
</html>

test.js $(document).ready(function(){ var movieTemplate = [ "

", "${Name}", "{{tmpl(Languages.results) 'languageTemplate'}}", "</tr", ].join("\n");
    var languageTemplate = "<em>${Name} </em>";

    $.template("movieTemplate", movieTemplate);
    $.template("languageTemplate", languageTemplate);

    $( "#foreignBtn" ).click( function() {
    getMovies( "Foreign", 0, 4 );
    });

    $( "#dramaBtn" ).click( function() {
    getMovies( "Drama", 0, 4 );
    });
})

The above will fail in firebug with: c.tmpl is not a function

pagles avatar Jan 20 '11 09:01 pagles

Thanks for taking the time to submit this issue. Just wanted to let you know this plugin is no longer being actively developed or maintained by the jQuery team. See README for more info.

rdworth avatar Oct 08 '11 06:10 rdworth