Knockout Fundamentals

Knockout is an MVVM JavaScript framework that allows us to quickly develop rich applications with a declarative style and rich template support.

Easier to create rich, desktop-like user interfaces with JavaScript and HTML.

Rich client side interactivity — Declarative binding, Observables

Key Concepts:

Dependency tracking via Observables

Declarative Binding:  example <input data-bind = “value: firstname”>

Template support

MVVM:

Separation pattern. Separation of concern : Behavior(JS) with structure(HTML)

Model(might be JSON)–View(HTML)..View Model(JS)

Create an observable:

Var myViewModel= {

firstName : ko.observable(:John”) };

Binding viewModel to the view: glue together by

Ko.applyBinding(myViewModel);

Html looks for Objects bind to data context.

In above example myViewModel is the object.

Ko.observable— build in function to tell/notify the UI that if any change happen in the data model.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s