Long-form bootstrapping syntax allowing multiple apps, root components#3852
Long-form bootstrapping syntax allowing multiple apps, root components#3852alxhub wants to merge 3 commits intoangular:masterfrom
Conversation
|
This is ready for an initial review while I verify that it will actually build and run - I expect there will be some changes to get the tests passing. |
471766e to
c4b5b59
Compare
|
Having lots of issues with the tests but debugging is yielding good results. I'm a little worried about backwards compatibility with bootstrap(), I think it will suffer, but it is an architectural change. |
There was a problem hiding this comment.
I think this should be split up: Dont' call DynamicComponentLoader.loadAsRoot, but implement the logic that is in DynamicComponentLoader.loadAsRoot directly here:
- call
Compiler.compileHost, which is asynchronous - call
ViewManager.createRootHostViewwith the result, which is synchronous
Could we have the new bootstrap adjust for this?
E.g. have an platform.compile(componentType, binding):Promise<CompiledApplication> and a CompileApplication.instantiate():ComponentRef and a
platform.compileAndCreate(componentType, bindings):Promise<ComponentRef>.
There was a problem hiding this comment.
This separation is important for serverside rendering, as there we compile once, cache the result, and create the root component multiple times (on every request).
|
I've solved the problem I was having with A solution to this problem is to introduce |
bcca6d7 to
5568762
Compare
|
@alxhub Awesome. Do you have some work in progress which you can share, so that we can start the review process? Let's resolve these questions as part of the review process. |
5568762 to
68db7d8
Compare
|
@mhevery This PR is the full bootstrapping change that's ready for review. I'm still having some issues with the Dart tests but I can work through those separately. |
e2f31f8 to
65f8aff
Compare
65f8aff to
e725cf3
Compare
d1fa8ea to
6598feb
Compare
This allows a single LifeCycle to be shared among multiple root components, since each root component has its own ChangeDetector configured.
… ROUTER_PRIMARY_COMPONENT binding. With the coming bootstrapping changes, a single application (and thus Router) can have multiple root components. One of these needs to be identified as the "primary" component from which the Router will load its configuration. This is now done by providing a ROUTER_PRIMARY_COMPONENT binding to the primary component type.
This change adds a syntax for bootstrapping Angular on a page that allows more fine-grained control of the hierarchy created. platform() creates a platform injector (of which there can only be one). From the platform, .application() creates an Angular application including a Zone and all specified application bindings (e.g. for the DOM, HTTP, Compiler, Renderer, etc). At the application level, .bootstrap() will bootstrap the given component into that application.
6598feb to
c3b6d42
Compare
|
User @alxhub does not have PR merging privileges. |
|
User @alxhub does not have PR merging privileges. |
|
@mhevery: Looks like I can't add the label, but it should be good to merge. Feel free to add it if you think the PR is ready to go in. |
|
Merging PR #3852 on behalf of @mhevery to branch presubmit-mhevery-pr-3852. |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
No description provided.