X

Geertjan's Blog

  • January 16, 2015

Knockout.js in 2 Minutes (Part 2)

Geertjan Wielenga
Product Manager

If you liked part 1, you should squeeze in another 2 minutes and watch part 2!

Code:

<script src="js/libs/knockout/knockout-min.js" type="text/javascript"></script>
Name: <input data-bind="value: name, valueUpdate:'afterkeydown'" />
<h3>
Hello, <span data-bind="text: name"></span>.
</h3>
<ul data-bind="foreach: courses">
<li><span data-bind="text: title"></span></li>
</ul>
<script type="text/javascript">
var viewModel = {
name: ko.observable("John"),
courses: ko.observableArray([{"title":"History"},{"title":"Geography"}])
};
ko.applyBindings(viewModel);
</script>

Join the discussion

Comments ( 1 )
  • guest Saturday, January 17, 2015

    Knockout seems great. Too bad one has to learn JavaScript and cannot use Java!


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.