Repository navigation
AOT with multiple root module #4624
Description
Activity
@hikalkan I think best practice in this case would be to manage this with routes and router guards. You can also lazy load those modules from the router so only the code needed to run would be downloaded.
I will try the lazy load first to see if it's possible. Thank you @deebloo
I suppose there is no way of doing that.
Reacted by Nektarios Konstantinidisneed to be able to select module. Error is thrown with aot on
@hikalkan did you get things working with the router?
No. What I did is to create a new RootModule which lazy loads other modules via router.
But I did not like that solution much :(@hikalkan ok. that does sound closer to best practice for angular though.
Hey I have followed this documentation : https://www.aspnetzero.com/Documents/Getting-Started-Angular
things went really good as expected. But after successful login I'm unable to see dashboard, it redirects me back to login. I guess it is something related to routing?I suppose here is not the best place to ask this question :) Can you write to the aspnetzero forum.
How long it will take to get a response on forum against this topic? http://forum.aspnetboilerplate.com/viewtopic.php?f=5&t=5201
@hansl can you have a look?
Can anyone from the Angular team confirm the principle behind AoT not supporting multiple entry points?
Is it a basic principle of Angular 2+ that there must only ever be one root module and everything has to be part of one monolithic SPA application with centralized routing?
This feels like a distinct lack of flexibility that real world applications often require. In my mind AoT needs to just work, regardless of whether or not I have a single monolithic application, multiple sub application or I just want to drop in some components on a static marketing page that is optimized for SEO.
Reacted by ysgk, gjdev, iJungleboy, Simon Gardner, Matthew Allen, Jordan, Reinier de Vries, atluri64, Nathan, Raymond Meerburg and 26 moreReacted by WasparI've patched the AngularCompilerPlugin to allow for multiple entry points. Are you interested in a PR?
Reacted by Chris Nicola, John Chijioke, Pavlo Glazkov, strongpauly, Sergey Gruntovsky, Matt Psaltis, tubli, Cristian Martinez, Orest Prystayko, Nikolai Orekhov and 1 more7 remaining items
Heya, is this still a problem? Can someone provide a repro using the current version of Angular CLI please?
- addedneeds: more infoReporter must clarify the issueReporter must clarify the issueand removed
on Oct 1, 2019 - addedfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesand removedneeds: more infoReporter must clarify the issueReporter must clarify the issue
on May 21, 2020 angular-automatic-lock-bot commented
on Dec 6, 2020 More actionsThis issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
- locked and limited conversation to collaborators
on Dec 6, 2020
OS?
Windows 10
Versions.
Node v6.9.1
Npm v3.10.8.
ng-cli beta.30
Repro steps.
In brief, I want to bootstap one of my root modules based on an async call to the server. So, my code is like that:
Given workaround works fine when AOT is disabled. But, when AOT is enabled, it only compiles AppModule and the logic above can not work.
I know AOT statically analysis main.ts and bundles all module files starting from the root module. But I also believe my case is not so unique. I simple want to bootstrap a different module if user has not logged in.
So, isn't that possible or is there a way of doing it? If not, how do you recommend as a best practice? Should I merge 2 modules and implement the logic with routes and route guards?
Thanks.