Durandal life cycle
It is important we understand clearly how a Durandal application works. This is a schema of how your application starts:
The
index.html
page uses RequireJS to request themain.js
file.The
main.js
file configures require and defines the main module, which is responsible for the application configuration, and launches the shell module.The shell module handles the global context of the application. It manages components that will be persistent along the different life cycles. In the starter kit application, it manages the search bar. But it can also manage the log in and log out functionality, for example. The shell module is what configures all routes.
Finally, the router configures the navigation along all the pages the application has.
The activation life cycle
The activation life cycle controls the activation and the deactivation of the page. Durandal allows us to use predefined methods to access different parts of the cycle. Let's take...