fix(ivy): align NgModule registration timing with ViewEngine (#30244)
Currently in Ivy `NgModule` registration happens when the class is declared, however this is inconsistent with ViewEngine and requires extra generated code. These changes remove the generated code for `registerModuleFactory`, pass the id through to the `ngModuleDef` and do the module registration inside `NgModuleFactory.create`. This PR resolves FW-1285. PR Close #30244
This commit is contained in:

committed by
Alex Rickabaugh

parent
2f35dbfd3b
commit
f74373f2dd
@ -162,6 +162,7 @@ export class NgModuleDecoratorHandler implements DecoratorHandler<NgModuleAnalys
|
||||
exports,
|
||||
imports,
|
||||
containsForwardDecls,
|
||||
id,
|
||||
emitInline: false,
|
||||
// TODO: to be implemented as a part of FW-1004.
|
||||
schemas: [],
|
||||
@ -257,11 +258,6 @@ export class NgModuleDecoratorHandler implements DecoratorHandler<NgModuleAnalys
|
||||
ngModuleStatements.push(callExpr.toStmt());
|
||||
}
|
||||
}
|
||||
if (analysis.id !== null) {
|
||||
const registerNgModuleType = new ExternalExpr(R3Identifiers.registerNgModuleType);
|
||||
const callExpr = registerNgModuleType.callFn([analysis.id, new WrappedNodeExpr(node.name)]);
|
||||
ngModuleStatements.push(callExpr.toStmt());
|
||||
}
|
||||
return [
|
||||
{
|
||||
name: 'ngModuleDef',
|
||||
|
Reference in New Issue
Block a user