feat(ivy): register NgModules with ids when compiled with AOT (#29980)

This commit adds registration of AOT compiled NgModules that have 'id'
properties set in their metadata. Such modules have a call to
registerNgModuleType() emitted as part of compilation.

The JIT behavior of this code is already in place.

This is required for module loading systems (such as g3) which rely on
getModuleFactory().

PR Close #29980
This commit is contained in:
Alex Rickabaugh
2019-04-18 16:22:53 -07:00
committed by Ben Lesh
parent 4229b41057
commit 0df719a461
5 changed files with 46 additions and 3 deletions

View File

@ -268,7 +268,10 @@ export {
SWITCH_RENDERER2_FACTORY__POST_R3__ as ɵSWITCH_RENDERER2_FACTORY__POST_R3__,
} from './render/api';
export {getModuleFactory__POST_R3__ as ɵgetModuleFactory__POST_R3__} from './linker/ng_module_factory_loader';
export {
getModuleFactory__POST_R3__ as ɵgetModuleFactory__POST_R3__,
registerNgModuleType as ɵregisterNgModuleType,
} from './linker/ng_module_factory_loader';
export {
publishGlobalUtil as ɵpublishGlobalUtil,

View File

@ -9,6 +9,7 @@
import {ɵɵdefineInjectable, ɵɵdefineInjector,} from '../../di/interface/defs';
import {ɵɵinject} from '../../di/injector_compatibility';
import * as r3 from '../index';
import {registerNgModuleType} from '../../linker/ng_module_factory_loader';
import * as sanitization from '../../sanitization/sanitization';
@ -130,5 +131,7 @@ export const angularCoreEnv: {[name: string]: Function} = {
'ɵɵsanitizeResourceUrl': sanitization.ɵɵsanitizeResourceUrl,
'ɵɵsanitizeScript': sanitization.ɵɵsanitizeScript,
'ɵɵsanitizeUrl': sanitization.ɵɵsanitizeUrl,
'ɵɵsanitizeUrlOrResourceUrl': sanitization.ɵɵsanitizeUrlOrResourceUrl
'ɵɵsanitizeUrlOrResourceUrl': sanitization.ɵɵsanitizeUrlOrResourceUrl,
'ɵregisterNgModuleType': registerNgModuleType,
};