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

Advanced composition

In Chapter 5, Durandal – the Knockout Framework, we covered the basic and common uses of Durandal's composition system. This section will cover further composition techniques such as caching, transitions, and composition mode.

View caching

By default, the view rendered by the composition binding is discarded when the composed module is changed. This results in the DOM contents of the composition binding always being only the current module's view. The cacheView option on the composed binding will change this behavior so that Durandal can keep any view composed. If a module is reactivated using the same object that is already bound to a view, it will not be recreated. Both the compose and router bindings have this option:

<div ...

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