Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/ExternalTemplateSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ ko.utils.extend(ExternalTemplateSource.prototype, {
self.data("precompiled",null);
self.template(tmpl);
self.loaded = true;

if( ko.isWriteableObservable( self.options.loaded ) ) self.options.loaded(true); // this alows to pass a writeable observable to the template binding in order to get notified when the template was loaded
// example:
// <script> myWriteableObservable = ko.observable( false ); </script>
// <div data-bind="template: {name: 'mytemplate', loaded: myWriteableObservable } "></div>
// <div data-bind="visible: myWriteableObservable">Template was loaded</div>


});
}
});
});