Saturday 15 February 2014

javascript - Using underscore.js, is there a way to determine when a template has finished rendering -


I am working on a project and we are using underscore JS for thermoplating. Is there a way to determine if the template's rendering is finished, then I can say a function call again?

This project includes jQuery, but does not include Backbone.js, if your answer helps.

Thank you! Mike

_ template returns the actual evaluation template. That function returns results as string. Therefore whenever the function returns, it is not asynchronous, it is rendered, it is not asynchronous.

Example from the document:

  var compiled = _.template ("hello: "); Compiled ({name: 'mo'}); = & Gt; "Hello: mo"   

Then you can simply call the next function call after rendering call:

  var compiled = _.template (" Hello: & lt;% = name% & gt; "); Var result = compiled ({name: 'moe'}); SomeOtherFunction ();    

No comments:

Post a Comment