Book Image

Knockout.JS Essentials

Book Image

Knockout.JS Essentials

Overview of this book

Table of Contents (16 chapters)
KnockoutJS Essentials
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

The navigation and shell templates


As we did in Chapter 7, Durandal – The KnockoutJS Framework, we are going to compose our shell.html view in two parts: shell.html and navigation.html.

The catalog module

In the Knockout cart, we have a view-model that manages all parts of the application. Here we are going to split that big view-model into several parts. The first part is the catalog.

Here we have a schema of how it should work:

The workflow of the catalog module

Catalog will contain just the partial that includes the search bar and the table with its actions. This makes the view-model smaller and therefore more maintainable.

Although files will be split into different folders, catalog is a module by itself. It contains the view-model, the view, and some services that will only work inside this module. Other components will be required, but they will be shared by more modules along the live cycle of the application.

  1. Create a file named catalog.js in the viewmodels folder and define a basic reveal...