JSFiddle - React, Tailwind, and code Playground
by rniemeyer
HTML
<ul data-bind="foreach: vms">
<li>
<button data-bind="click: $parent.currentVM, text: 'Launch ' + id"></button>
</li>
</ul>
<hr/>
<div data-bind="with: currentVM">
<h1>This is the <span data-bind="text: id"></span> view model</h1>
</div>
JavaScript
var ViewModel = function() {
this.vms = [
{ id: 1, data: {} },
{ id: 2, data: {} },
{ id: 3, data: {} }
];
this.currentVM = ko.observable();
};
ko.applyBindings(new ViewModel());