O'Reilly logo

Mastering KnockoutJS by Timothy Moran

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Widgets

Widgets in Durandal are similar to Knockout components, in that they are viewmodel/view pairs that are instantiated from the DOM. Components use a custom element while widgets use a custom binding. There is definitely some overlap between them, but Durandal's widget system came before Knockout's component system. Widgets also have a killer feature over components; their views can have replaceable sections that can be overridden. This feature is commonly known as transclusion—the inclusion of one document inside another.

It's difficult to talk about the widget API without using an example. When we looked at components, we made a contact list component; so let's see what it would look like doing the same thing with a widget. It may not be ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required