Architecture

For a detailed description, please refer to the PageModelManager section of the SPA Blueprint document.

ModelRouter

The ModelRouter - when enabled - encapsulates the HTML5 History API functions pushState and replaceState to guarantee a given fragment of model is pre-fetched and accessible. It then notifies the registered front end component that the model has been modified.

Manual vs Automatic Model Routing

The ModelRouter automates the fetching of fragments of the model. But as any automated tooling it comes with limitations. When needed the ModelRouter can be disabled or configured to ignore paths using meta properties (See the Meta Properties section of the SPA Page Component document). Front end developers can then implement their own model routing layer by requesting the PageModelManager to load any given fragment of model using the getData() function.

NOTE
Currently the We.Retail Journal sample React project illustrates the automated approach while the Angular project illustrates the manual one. A semi-automated approach would also be valid use-case.
CAUTION
The current version of the ModelRouter only support the use of URLs that points to the actual resource path of Sling Model entry points. It doesn’t support the use of Vanity URLs or aliases.