-
Notifications
You must be signed in to change notification settings - Fork 26.5k
feat(router): register NgModuleFactory objects. #11211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@@ -0,0 +1,95 @@ | |||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this file here? I don't think it is part of the PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, botched merge.
fde9998
to
cac1b6f
Compare
PTAL, now with |
@@ -107,6 +107,11 @@ export class Identifiers { | |||
runtime: NgModuleInjector, | |||
moduleUrl: assetUrl('core', 'linker/ng_module_factory') | |||
}; | |||
static RegisterLoadedModuleFn: IdentifierSpec = { | |||
name: 'registerLoadedModule', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps registerModuleFactory
would be a better name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
One more rename, otherwise LGTM. |
Also LGTM from me. |
* An opaque ID for this module, e.g. a name or a path. Used to identify modules in `getNgModule`. | ||
* If left `undefined`, the `NgModule` will not be registered with `getNgModule`. | ||
*/ | ||
id: string|undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove |undefined
as that is not compatible with typescript 1.8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
When lazily loading code, users need to be able to get hold of the NgModuleFactory. For SystemJS environments, the SystemJS registry serves this purpose. However other environments, such as modules compiled with Closure compiler, do not expose exports object or a path based registry. For these environments, `@NgModule` objects can include an identifier, and the loading code can then pass `loadModule(id).then(() => getNgModule(id))` to the router.
c85a39d
to
4b0b23b
Compare
4b0b23b
to
d673747
Compare
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. |
When lazily loading code, users need to be able to get hold of the
NgModuleFactory. For SystemJS environments, the SystemJS registry serves
this purpose. However other environments, such as modules compiled with
Closure compiler, do not expose exports object or a path based registry.
For these environments,
@NgModule
objects can include an identifier, andthe loading code can then pass
loadModule(id).then(() => getNgModule(id))
to the router.