Angular 6: Multi Page Application (MPA) is possible?

Amit Shah picture Amit Shah · Jun 10, 2018 · Viewed 24.1k times · Source

After spending the whole day on Google, my question remains unanswered.

As I am new to creating Angular app using version 6.0.4. my first and simple question is:

  1. Is it possible to configure Angular app with multilevel landing pages?

    Example: Without exposing the links on top nav bar of the root page, I need direct links to these pages where the users have their own different menus. like: WordPress/admin panel is different than its website.

    • /home for public view
    • /admin for admin section after login
    • /customer for customer section after login

this is because I found that there is only one app.component.html file where we can include our components using Routing but with static navigation bar on the top.

  1. If not:

    How to run multiple apps created for all above 3 section can be run under the same url:port?

Answer

Amit Shah picture Amit Shah · Jun 11, 2018

SOLVED

By following this: https://angular.io/guide/lazy-loading-ngmodules

NOTE: at the end must comment out the navigation buttons in the app.component.html

<!--
<h1>
  {{title}}
</h1>

<button routerLink="/customers">Customers</button>
<button routerLink="/orders">Orders</button>
<button routerLink="">Home</button>
-->

<router-outlet></router-outlet>