Can i import some custom module after a angular 2 app bootstraped?

I am developing a business web app using angular2 based on web api. Now i got a problem. I want to bootstrap my angular2 app using AuthModule(this is my custom module). This module have functionalty to perform login and signup operation. I don't want to bootstrap my full angular2 app when a user not logged in. I want to import all modules and components After a user successfully logged in. Just like that..

In main.ts

import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
const platform = platformBrowserDynamic();
platform.bootstrapModule(AppModule);

after login success,

// i need to import my modules after login
//platform.importModule([MyCustomModule]);.....

I don't know this is possible or not. I don't see any API documentation in angular.io site. Please give me any idea if this is possible.

Thanks.


ANSWERS:


why you are using platform.importModule for loading your customModule. you can use lazy loading of angular 2 for this.

here are some useful links:

in this see how they have used lazy loading.

study from these links how to use lazy loading.



 MORE:


 ? Can i import some custom module after a angular 2 app bootstraped?
 ? Angular 2 - Bootstrap (Ng2-Bootstrap) typeahead implementation
 ? Dynamically added using angular bootstrap date-time-picker not working
 ? how can i use "SystemJsNgModuleLoader" in angular 2 to import dynamic modules to app?
 ? ngModule import module for entire app?
 ? Angular 2 build error - '../@angular/platform-browser-dynamic' no exported member 'bootstrap'
 ? Angular 2 Login Module with template
 ? PHP Array, Dynamic Array Name or Other Technique
 ? PHP Array, Dynamic Array Name or Other Technique
 ? PHP Array, Dynamic Array Name or Other Technique