Why not use the params attribute to save the source text:
HTML:
<demo-widget params="initialValue: 'text i need to get...'"></demo-widget>
JS:
ko.components.register('demo-widget', { template: "<div data-bind=\"text: 'content in my component. previous was: ' + initialValue \"> </div>" }); ko.applyBindings();
source share