Search code examples
javascriptknockout.jsjquery-templates

Invoke callback when template loads?


I have got a few problems currently where I have a Cufon/Validation setup method that needs to be called when a template has loaded. As for some reason it doesn't always seem to activate correctly until the template has finished loading (currently calling setup within documentReady).

Is there any way to do anything similar to this:

template: { name: "myTemplate", loaded: someCallback }

I couldn't see anything in the documentation about this, but I am not sure if there is some best practise to side step the need for this functionality.


Solution

  • It does supports afterRender . See Note 4 in the template binding documentation.