JSFiddle - React, Tailwind, and code Playground
by jhoguet
HTML
<script src="http://github.com/downloads/SteveSanderson/knockout/knockout-2.0.0.js"></script>
JavaScript
//this works
var viewModel = {
Topic: ko.observable('some topic'),
Description: ko.observable("some description")
};
//but this is more reusable
function TopicViewModel(options){
options = options || {};
var self = this;
self.Topic = ko.observable(options.Topic);
self.Description = ko.observable(options.Description);
}
var topic = new TopicViewModel({Topic: 'some topic', Description: 'Some Description'});