im implementing the widget example for knockout http://knockoutjs.com/documentation/component-overview.html
loading template from external html with requirejs not working for me
ko.components.register('like-or-dislike', {
template: { require: 'text!files/component-like-widget.html' }
});
i put the html containing the template in external html. replace "files/" with my relative path "/views/_leyout" and it's not working i need a text.js file that loads the html? any example ?
"text.js" is a plugin wich you can download from the require-homepage. For me, the best way to do the config for knockout-components is the following:
config.js
component-name.js
Hope it helps :)
The answer of user3144678 is correct. You should include text plugin inside your project. Just for clarify how to use it I did some simple project:
project structure:
index.html:
app.js:
some-content.html:
the result will be alert with "just some text" inside.