feat(router): Support lazy loading standalone components with loadComponent#45705
Closed
atscott wants to merge 1 commit intoangular:masterfrom
Closed
feat(router): Support lazy loading standalone components with loadComponent#45705atscott wants to merge 1 commit intoangular:masterfrom
loadComponent#45705atscott wants to merge 1 commit intoangular:masterfrom
Conversation
AndrewKushnir
approved these changes
Apr 22, 2022
Contributor
AndrewKushnir
left a comment
There was a problem hiding this comment.
Looks great 👍 Thanks!
AndrewKushnir
approved these changes
Apr 22, 2022
Contributor
AndrewKushnir
left a comment
There was a problem hiding this comment.
Reviewed-for: public-api
4ab5864 to
e14e4b1
Compare
c3e56bc to
e29da31
Compare
Contributor
Author
|
presubmit with updated patch |
jessicajaniuk
approved these changes
Apr 25, 2022
alxhub
reviewed
Apr 25, 2022
alxhub
approved these changes
Apr 25, 2022
…mponent`
Similarly to the symmetry being strengthened between children and loadChildren,
a new loadComponent property will be introduced as the asynchronous version of component.
This will allow for direct single-component lazy loading:
```
{path: 'lazy/a', loadComponent:
() => import('./lazy/a.component').then(m => m.ACmp)},
{path: 'lazy/b', loadComponent:
() => import('./lazy/b.component').then(m => m.BCmp)},
```
This option requires that the component being loaded is standalone and
is implemented as a runtime check.
Other notes:
* Components are not loaded until all guards and resolvers complete.
* Loading the component is included in the function passed to the router
preloading strategy
* `RouteConfigLoadStart` and `RouteConfigLoadEnd` events emit at the
start and end of the component loading
* `CanLoad` guards _do not_ apply to `loadComponent`. `canActivate`
should be used instead, just like you would do if it were simply
`component` instead.
Contributor
Author
|
This PR was merged into the repository by commit 50004c1. |
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note: this is rebased on top of #45700 which is rebased on the
standalonebranchSimilarly to the symmetry being strengthened between children and loadChildren,
a new loadComponent property will be introduced as the asynchronous version of component.
This will allow for direct single-component lazy loading:
This option requires that the component being loaded is standalone and
is implemented as a runtime check.
Other notes:
preloading strategy
RouteConfigLoadStartandRouteConfigLoadEndevents emit at thestart and end of the component loading
CanLoadguards do not apply toloadComponent.canActivateshould be used instead, just like you would do if it were simply
componentinstead.