This document provides an overview of Knockout.js (KO), including what it is, its benefits, features and the Model-View-View Model (MVVM) pattern it uses. KO is a JavaScript library that helps create rich, interactive user interfaces using declarative bindings. It is small, lightweight, fully documented and supports two-way binding between models and views. Key features include observables to track dependencies, templates for display, and computed observables to transform data. While it has a learning curve, KO streamlines interface development by connecting HTML directly to JavaScript models.
My INSURER PTE LTD - Insurtech Innovation Award 2024
KO Agenda Overview Benefits Features
1. Agenda
What is Knockout.js (KO) ?
Benefits
Model View View Model (MVVM)
Key Features Of KO
Code Time
Disadvantages
References
Page : 2Object Edge Inc
2. What is Knockout.js ?
Knockout is a JavaScript library that helps you to create
rich, responsive display and user interactive interfaces.
Developed and maintained by Steve Sanderson, a
Microsoft employee In July 5, 2010.
Jquery Vs Knockout
Based on Model-View-View Model pattern
Object Edge Inc Page : 3
3. Benefits
Free, open source
Pure JavaScript (works with any web framework)
Small & lightweight (40kb minified & 13kb after Zipping)
No dependencies
Supports all mainstream browsers (IE6+, FF2+ and
others)
Fully documented
Can be used for existing Website
Object Edge Inc Page : 4
4. MVVM
Model - Domain Data (e.g. Database Server)
View – User Interface (HTML)
View Model
Object Edge Inc Page : 5
5. Key Features Of KO
Declarative Bindings : connect data to UI
Automatic UI Refresh
Dependency Tracking (using observables)
Templating
Object Edge Inc Page : 6
6. Observables / Properties
1. data-bind attributes in HTML
2.ko.observable() - the properties
3.ko.applyBindings() to activate bindings
Example :
<div data-bind="text: message"> </div>
var viewModel = {
message: ko.observable('Welcome')
}
Object Edge Inc Page : 7
12. Disadvantages
1.Hard to use templates on external files – hard to co-
work
2.Ko is only for two way binding so need to use other
tool or library for other needs.
3.Sometimes hard to debug.
4.Learning curve : Binding Expressions
5.Multiple view models with annoying amount of
similarity
Object Edge Inc Page : 13