Angular 2 How to download 2 root application components separately

Is it possible to load 2 different root components (not side by side on the page). The plunker example found , the only difference is that both root components are loaded on the same page.

<body> <my-app>Loading...</my-app> <my-sec>Loading...</my-sec> </body> 

What I want to achieve is that each of the components has its own layout and is not shared with app.component.

Example: app.component will have a presentation template for regular users, where admin.component will have a panel template.

Is this achievable? or I need to create for this 2 separate projects (one for normal viewing, another for representing the panel)

+3
source share
1 answer

Although I could not understand the correct answer, this is what I came up with after a few days of playing with it. This "something" is good enough for my needs.

Here is a link to an example of what I did on github .

Basically, I decided to abandon the idea of ​​downloading the two root components separately and dynamically loading the components.

If there is any area of ​​improvement, please let me know.

0
source

Source: https://habr.com/ru/post/1258706/


All Articles