Clone this wiki locally
This Recipes Wiki is a collection of tips for using Knockout in a range of common scenarios. These recipes assume you have at least some basic experience with Knockout, so if you're completely new to all this, you'll find it much more useful to start with the interactive tutorials, the examples, or the intro video instead.
- Asynchronous dependent observables - great for creating dependent observables whose values come from Ajax requests
- Dirty tracking - a way of keeping track of whether or not the user has modified some data structure
- jQuery UI Autocomplete - See Knockout with JQuery UI Autocomplete and example on jsfiddle
- Using Knockout with ASP.NET MVC
- Knockout N-Level Undo Example
- Scott's Method - Scott uses Backbone's router for routing, amplify.js for ajax, and uses dirty tracking to automatically save his models when they change.
- Google FastButton knockout binding for mobile web apps - Eliminate the 300ms delay for click events on mobile devices.
- SVG and MVVM with Knockout - Henry Tan Setiawan explains how you can build SVG graphics with KO and the MVVM pattern
- SVG Graphics - Trajectory simulator - Henry Tan Setiawan demonstrates using Knockout to create dynamic SVG graphics
- Use an observable as a jQuery promise
- Tristate a boolean observable
- Todo: Validation
- Todo: Using Knockout with CoffeeScript
- Todo: Using Knockout with Ruby on Rails
- Todo: Using Knockout with Node.js
We welcome contributions to this collection of recipes. Any GitHub member may edit this wiki. Please note that we edit this wiki pretty ruthlessly, so please don't be offended if we change or remove any contributions that either don't fit the pattern, aren't implemented optimally, or are just too long or complicated to be broadly useful!
If you're unsure about whether or not your recipe should be added, or want feedback on your implementation, please start a thread on the official forum.