I was studying about Knockout.js and how it works with Magento 2.
Then I reached the topic: template integration, in the first sample of it I'm presented to this notation:
<div data-bind="template:'Namespace_Module/sample'"></div>
Which will try to render the template located at:
app/code/Namespace/Module/view/frontend/web/template/sample.html
It's working in Magento versions equals/lower than 2.1.
In greater versions it's throwing the following error:
Uncaught TypeError: Unable to process binding "template: function(){return 'Namespace_Module/sample' }"
Message: Cannot read property 'name' of undefined
at RemoteTemplateEngine.makeTemplateSource (engine.js:55)
at RemoteTemplateEngine.renderTemplate (engine.js:116)
at executeTemplate (knockout.js:4886)
at ko.dependentObservable.disposeWhen (knockout.js:4950)
at evaluateImmediate (knockout.js:1737)
at Object.ko.computed.ko.dependentObservable (knockout.js:1946)
at Object.ko.renderTemplate (knockout.js:4942)
at update (knockout.js:5080)
at ko.dependentObservable.disposeWhenNodeIsRemoved (knockout.js:3004)
at evaluateImmediate (knockout.js:1737)
I was trying to understand why it's happening looking for the change in github, but it's not clear to me:
Now it requires a bindingContext (which contain the name attribute requested in exception) but I don't know how it's initialized.