Reputation: 123218
I am trying to use a component. I am already ractive components successfully, however for some reason this component just doesn't work:
var Ractive = require("ractive")
var log = console.log.bind(console);
var uploadComponent = Ractive.extend({
isolated: false,
template: 'test',
data: {}
});
module.exports = uploadComponent;
Produces the error:
Ractive.js: Could not find template for partial "previewVideo"
Update: component in being used as follows:
In myapp/index.js
var previewVideo = require('component-preview-video');
new Ractive({
el: $('.myapp-ui'),
template: myAppTemplate,
components: {
previewVideo,
...many other components that work
},
oncomplete: function(){....}
},
In myapp.mustache
:
{{>previewVideo}}
How can the template be missing? It clearly exists. Where is ractive trying to look to find it? How can I debug this?
Upvotes: 0
Views: 254
Reputation: 29605
Partials and components are different (although there's some overlap in terms of concept and functionality) – if previewVideo
is a component, it needs to be included like so:
<previewVideo/>
If it is a partial (though I'm guessing not, from the sample code) then you'd register it with Ractive via partials
and not components
:
var previewVideo = require('component-preview-video');
new Ractive({
el: $('.myapp-ui'),
template: myAppTemplate,
partials: {
previewVideo
},
oncomplete: function(){....}
});
Upvotes: 3