SlideShare a Scribd company logo
Knockout JS Development - a Quick Understanding
With and Without Knockout
UI Patterns
Data &
Bindings
Separation
of Concerns
Structured
JavaScript
Knockout JS Development - a Quick Understanding
Knockout JS Development - a Quick Understanding
Knockout JS Development - a Quick Understanding
Knockout JS Development - a Quick Understanding
Knockout JS Development - a Quick Understanding
6+ 2+
Separates behavior and structure
Declarative bindings
Observables
Knockout JS Development - a Quick Understanding
Knockout JS Development - a Quick Understanding
Knockout JS Development - a Quick Understanding
data-bind="value: firstName"
Declarative
Binding
ko.observable
ko.applyBindings
Create an
Observable
Bind the ViewModel
to the View
Source object
Push from Source to Target
With and Without Knockout
Observable
Taylor 110
Taylor 914ceTaylor 914ce
Taylor 110
data-bind
Declarative
Binding
product: {
id: 1001,
model: ko.observable("Taylor 314ce"),
salePrice: ko.observable(1199.95)
}
ko.applyBindings(data);
Source object
Bind Source to Target, & Vice Versa
With and Without Knockout
Observable
Computed
computed dependentObservable
ko.computed
this this.qty
vm
observables
owner
With and Without Knockout
Observable
Computed
ObservableArray
Knockout JS Development - a Quick Understanding
var myViewModel = {
salesPerson: ko.observable("John"),
empNum: ko.observable(39811),
products: ko.observableArray([
{ model: "Taylor 314CE", price: 1749, id=321 },
{ model: "Martin D40", price: 1899, id=479 }
])
};
<span data-bind="text: products().length"></span>
Pre-populating
Operating on
observableArray
With and Without Knockout
Observable
Computed
ObservableArray
Built In Bindings
enable value
options
value
optionsText
optionsValue
Built into Knockout
Binding for element
attributes
Multiple binding
expressions
attr checked click css disable
enable event hasfocus html options
optionsText optionsValue selectedOptions style submit
text uniqueName value visibletext value
click disable
enable
attr
Display and state bindings
Text and value bindingsBindings for specific attributes
visible
event
Event bindings
With and Without Knockout
Observable
Computed
ObservableArray
Built In Bindings
Templates
• If truthy conditionif
• If falsy conditionifnot
• Execute for each item in a listforeach
• Shortcut to execute for the objectwith
template: {name: 'productsTmpl', foreach: lines}
Pass the context for the template with “foreach”
productsTmpl
if: lines().length > 0
Any “truthy” expression
with: model
text: brand
text: name
<div>
<div data-bind="text: model().brand"></div>
<div data-bind="text: model().name"></div>
</div>
All Part of the
Native Template Engine
in Knockout
With and Without Knockout
Observable
Computed
ObservableArray
Built In Bindings
Templates
Custom Binding Handlers
Knockout JS Development - a Quick Understanding
function(element, valueAccessor
function(element, valueAccessor
Runs first time the binding is
evaluated
Runs after init and every
time one of its observables
changes
element, valueAccessor, allBindingsAccessor, viewModel
valueAccessor
element
element, valueAccessor, allBindingsAccessor, viewModel
valueAccessor
element element
Bound DOM
element
What is passed
to the binding
All other bindings
on same element
The
viewmodel
With and Without Knockout
Observable
Computed
ObservableArray
Built In Bindings
Templates

More Related Content

PPT
Aνακύκλωση
PDF
3.Mechanical Drawing
PPTX
数学はアートを創るか?―Processingによる実践
PDF
Contracte ús mòbil adolescents. Katia Velar.
PPTX
5-ΜΑΘΑΙΝΩ ΤΟ POWERPOINT.pptx
PDF
UML
PPTX
Knockout js
PPTX
#2 Hanoi Magento Meetup - Part 2: Knockout JS
Aνακύκλωση
3.Mechanical Drawing
数学はアートを創るか?―Processingによる実践
Contracte ús mòbil adolescents. Katia Velar.
5-ΜΑΘΑΙΝΩ ΤΟ POWERPOINT.pptx
UML
Knockout js
#2 Hanoi Magento Meetup - Part 2: Knockout JS

Viewers also liked (20)

PPTX
Magento Meetup New Delhi- Magento2 plugins
PPTX
Magento Meetup New Delhi- Magento2 Ui component
PPTX
Magento Meetup New Delhi- API
PDF
Magento Meetup New Delhi- Magento2 Speed Optimization
PPTX
Magento Meetup New Delhi- Magento2 code generation
PDF
Getting your Hands Dirty Testing Magento 2 (at London Meetup)
PPTX
Magento 101: A technical overview
PDF
Knockout js (Dennis Haney)
PPTX
Knockout js
PPTX
knockout.js
PPTX
Knockout (support slides for presentation)
PPTX
Fundaments of Knockout js
PPTX
Knockout.js explained
PPTX
Introduction to Knockoutjs
PPT
Knockout.js
PPTX
Knockout js
PPT
KnockoutJS and MVVM
PDF
Knockout js session
PDF
An introduction to knockout.js
KEY
Knockout.js presentation
Magento Meetup New Delhi- Magento2 plugins
Magento Meetup New Delhi- Magento2 Ui component
Magento Meetup New Delhi- API
Magento Meetup New Delhi- Magento2 Speed Optimization
Magento Meetup New Delhi- Magento2 code generation
Getting your Hands Dirty Testing Magento 2 (at London Meetup)
Magento 101: A technical overview
Knockout js (Dennis Haney)
Knockout js
knockout.js
Knockout (support slides for presentation)
Fundaments of Knockout js
Knockout.js explained
Introduction to Knockoutjs
Knockout.js
Knockout js
KnockoutJS and MVVM
Knockout js session
An introduction to knockout.js
Knockout.js presentation
Ad

Similar to Knockout JS Development - a Quick Understanding (20)

PPTX
Building HTML and JavaScript Apps with KnockoutJS and MVVM
PDF
Knockout mvvm-m2-slides
PDF
Knockoutjs
PDF
Knockoutjs databinding
PPT
Knockout Basics By Surekha Gadkari
PPTX
View models and binding
PDF
Effective Android Data Binding
PDF
Data Binding in Silverlight
PPTX
Angular Data Binding
PPTX
CiklumJavaSat_15112011:Alex Kruk VMForce
PPTX
Knockout.js
PDF
[FREE PDF sample] Programming Entity Framework DbContext 1st Edition Julia Le...
PPTX
PDF
Integration Testing With ScalaTest and MongoDB
PPTX
MVVM Magic in SharePoint 2010 using Knockoutjs!
PPT
Backbone.js
PPTX
The Magic of WPF & MVVM
PPTX
Will your code blend? : Toronto Code Camp 2010 : Barry Gervin
PPTX
AngularJS
PPTX
SQL for Web APIs - Simplifying Data Access for API Consumers
Building HTML and JavaScript Apps with KnockoutJS and MVVM
Knockout mvvm-m2-slides
Knockoutjs
Knockoutjs databinding
Knockout Basics By Surekha Gadkari
View models and binding
Effective Android Data Binding
Data Binding in Silverlight
Angular Data Binding
CiklumJavaSat_15112011:Alex Kruk VMForce
Knockout.js
[FREE PDF sample] Programming Entity Framework DbContext 1st Edition Julia Le...
Integration Testing With ScalaTest and MongoDB
MVVM Magic in SharePoint 2010 using Knockoutjs!
Backbone.js
The Magic of WPF & MVVM
Will your code blend? : Toronto Code Camp 2010 : Barry Gervin
AngularJS
SQL for Web APIs - Simplifying Data Access for API Consumers
Ad

More from Udaya Kumar (9)

PPTX
Typescript in 30mins
PPTX
AzureML TechTalk
PPTX
Innovations and Innovators Prepared by Sharika Shivani U.J
PDF
Html5-Exploring-Training Deck - OSMOSIS 10Oct - By Udayakumar Mathivanan
PPTX
KnockOutjs from Scratch
PPTX
BDOTNET AngularJs Directives - Uday
PPTX
Social Reformers Of India Prepared by Sharika Shivani U.J
PDF
Html5 Exploring -- by Udayakumar Mathivanan
PPTX
WPF For Beginners - Learn in 3 days
Typescript in 30mins
AzureML TechTalk
Innovations and Innovators Prepared by Sharika Shivani U.J
Html5-Exploring-Training Deck - OSMOSIS 10Oct - By Udayakumar Mathivanan
KnockOutjs from Scratch
BDOTNET AngularJs Directives - Uday
Social Reformers Of India Prepared by Sharika Shivani U.J
Html5 Exploring -- by Udayakumar Mathivanan
WPF For Beginners - Learn in 3 days

Recently uploaded (20)

PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
cuic standard and advanced reporting.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
A Presentation on Artificial Intelligence
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Big Data Technologies - Introduction.pptx
PDF
Modernizing your data center with Dell and AMD
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Electronic commerce courselecture one. Pdf
PDF
Approach and Philosophy of On baking technology
PDF
KodekX | Application Modernization Development
Encapsulation_ Review paper, used for researhc scholars
Digital-Transformation-Roadmap-for-Companies.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Network Security Unit 5.pdf for BCA BBA.
cuic standard and advanced reporting.pdf
20250228 LYD VKU AI Blended-Learning.pptx
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
A Presentation on Artificial Intelligence
Unlocking AI with Model Context Protocol (MCP)
Big Data Technologies - Introduction.pptx
Modernizing your data center with Dell and AMD
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Building Integrated photovoltaic BIPV_UPV.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Electronic commerce courselecture one. Pdf
Approach and Philosophy of On baking technology
KodekX | Application Modernization Development

Knockout JS Development - a Quick Understanding