ModuleManager
This component loads and initializes each module. It works with moduleCatalog and ModuleLoader to download modules if there are remote, then it loads the module's assemblies into the application domain.
Sometimes there are dependencies between modules, and they should be initialized in a specific order. The ModuleManager keeps track of these dependencies and initializes accordingly.

ModuleManager in Typescript
The framework has an implementation that mimics the ModuleManager. This class has a reference to the moduleCatalog to have access to the modules. In addition, it contains a reference to the DependencyContainer to instance each module when is required.

Loading a Module in Typescript
loading at application startup
When the application starts in Angular, the application modules are registered in the ModuleCatalog, then the Bootstrapper calls the run method of the ModuleManager and initializes the application's module.
Examining the TryToStartModuleLoad method in some point, the loadModule is called. The loadModule method tries to initialize the module. There are three cases to initialize it.
The first case uses the file generated in the migration process called ExternalModelConfig.ts with all the module path and imports, then it tries to Initialize the module.
The second case tries to initialize it using the RuntimeTypeInfo. it will search in the container for any type register with that type and tries to instance.
The third case tries to initialize it using the ModuleType.
Look the next diagram to see the complete process to load a module:
Loading manually
After a module is specified as on demand, the application can then ask the module to be loaded.
A Silverlight C# sample:
The framework in Typescript provides the same method to call and load a module.
Last updated
Was this helpful?