If you don't "override" the loadComponent method then the default component loader's loadComponent will be invoked which only calls the loadViewModel if you've provided a viewModel config option. In your getConfig method you are returning a config with require which means that your require.js module has to provide the necessary...

So let's say the template for "my-component" is (regardless of how it's defined) <span class="foo" data-bind="text: 'foo'"></span> The sentence "the template has already been injected into this element, but isn't yet bound" describes the state of the DOM for a given component. (A.K.A. componentInfo.element in the context of the createViewModel...

I imagine the lack of this option could be defended as such, considering the nature of the library (there, I said it), and the developer's team philosophy: Knockout is a library and unlike other MVC's it does not force you to use a framework-defined way to structure your application. If...

It's impossible in 3.2, however it would be possible in next version, see this commit and this test. For now to you have to pass parameters to component via params property Define your component to expect content parameter: ko.components.register('modal-dialog', { viewModel: function(params) { this.content = ko.observable(params && params.content || '');...

Returning a new instance depending on params contradicts the use of a shared instance viewmodel. This is exactly like using the viewmodel as constructor (accepting params) approach. If you want to create a single instance, modify its internals depending on params each time before the binding is applied, you can...

To provide your custom configuration handling logic you need to implement the loadComponent method as described in the documentation. However you need to watch out what you return from it, because according to the documentation: The template property has to contain an array of DOM nodes: so if your loader...

I managed to create a working solution (although in its infancy). As I still don't know how to add template code to the componentInfo I discovered it is possible to edit the things available in the componentInfo. (See the solution below) ko.components.loaders.unshift({ getConfig: function (name, callback) { var component; callback({...

For some reason 'this' inside the remove method is not refferring to KVPairList. This is why i usually proffer to use a scoped variable to refer to the instance and prevent this closure issues: Try this: function KVPairList(params) { var self = this; self.add = function(){ self.items.push(new KV(this.k(), this.v())); };...