简体   繁体   中英

How to lazy load modules in angular from another server?

How can we lazy load modules of an angular app from another server.

{
    path: 'somepath/:id',
    loadChildren: 'js from another server',
}

You can't lazy load modules which is present in another server. Angular is good for designed Single Page Application (SPA) in which code should be reside inside the URL in which the App Runs.

If we need to load the bundles present in another server. First Javascript needs to fetch the js file, related assets and css files. It will parse it and using Angular Interpreter it will update to the DOM. It's a time consuming task and it should be avoided by keeping performance and user experience in mind.

You can push those bundles codes to your server in which app run.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM