* Some declared components may be compiled asynchronously, and thus may not have their * ɵcmp set yet. If this is the case, then a reference to the module is written into * the `ngSelectorScope` property of the declared type.
(moduleType: Type<any>, ngModule: NgModule)
| 500 | * the `ngSelectorScope` property of the declared type. |
| 501 | */ |
| 502 | function setScopeOnDeclaredComponents(moduleType: Type<any>, ngModule: NgModule) { |
| 503 | const declarations: Type<any>[] = flatten(ngModule.declarations || EMPTY_ARRAY); |
| 504 | |
| 505 | const transitiveScopes = transitiveScopesFor(moduleType); |
| 506 | |
| 507 | declarations.forEach((declaration) => { |
| 508 | declaration = resolveForwardRef(declaration); |
| 509 | if (declaration.hasOwnProperty(NG_COMP_DEF)) { |
| 510 | // A `ɵcmp` field exists - go ahead and patch the component directly. |
| 511 | const component = declaration as Type<any> & {ɵcmp: ComponentDef<any>}; |
| 512 | const componentDef = getComponentDef(component)!; |
| 513 | patchComponentDefWithScope(componentDef, transitiveScopes); |
| 514 | } else if ( |
| 515 | !declaration.hasOwnProperty(NG_DIR_DEF) && |
| 516 | !declaration.hasOwnProperty(NG_PIPE_DEF) |
| 517 | ) { |
| 518 | // Set `ngSelectorScope` for future reference when the component compilation finishes. |
| 519 | (declaration as Type<any> & {ngSelectorScope?: any}).ngSelectorScope = moduleType; |
| 520 | } |
| 521 | }); |
| 522 | } |
| 523 | |
| 524 | /** |
| 525 | * Patch the definition of a component with directives and pipes from the compilation scope of |
no test coverage detected
searching dependent graphs…