( rootSelectorOrNode: any, componentDef: ComponentDef<unknown>, componentBindings: Binding[] | undefined, directives: (Type<unknown> | DirectiveWithBindings<unknown>)[] | undefined, allowNonStandaloneDirectives?: boolean, )
| 454 | } |
| 455 | |
| 456 | function createRootTView( |
| 457 | rootSelectorOrNode: any, |
| 458 | componentDef: ComponentDef<unknown>, |
| 459 | componentBindings: Binding[] | undefined, |
| 460 | directives: (Type<unknown> | DirectiveWithBindings<unknown>)[] | undefined, |
| 461 | allowNonStandaloneDirectives?: boolean, |
| 462 | ): TView { |
| 463 | const tAttributes = rootSelectorOrNode |
| 464 | ? ['ng-version', '0.0.0-PLACEHOLDER'] |
| 465 | : // Extract attributes and classes from the first selector only to match VE behavior. |
| 466 | extractAttrsAndClassesFromSelector(componentDef.selectors[0]); |
| 467 | let creationBindings: Binding[] | null = null; |
| 468 | let updateBindings: Binding[] | null = null; |
| 469 | let varsToAllocate = 0; |
| 470 | |
| 471 | if (componentBindings) { |
| 472 | for (const binding of componentBindings as BindingInternal[]) { |
| 473 | varsToAllocate += binding[BINDING].requiredVars; |
| 474 | |
| 475 | if (binding.create) { |
| 476 | binding.targetIdx = 0; |
| 477 | (creationBindings ??= []).push(binding); |
| 478 | } |
| 479 | |
| 480 | if (binding.update) { |
| 481 | binding.targetIdx = 0; |
| 482 | (updateBindings ??= []).push(binding); |
| 483 | } |
| 484 | } |
| 485 | } |
| 486 | |
| 487 | if (directives) { |
| 488 | for (let i = 0; i < directives.length; i++) { |
| 489 | const directive = directives[i]; |
| 490 | if (typeof directive !== 'function') { |
| 491 | for (const binding of directive.bindings as BindingInternal[]) { |
| 492 | varsToAllocate += binding[BINDING].requiredVars; |
| 493 | const targetDirectiveIdx = i + 1; |
| 494 | |
| 495 | if (binding.create) { |
| 496 | binding.targetIdx = targetDirectiveIdx; |
| 497 | (creationBindings ??= []).push(binding); |
| 498 | } |
| 499 | |
| 500 | if (binding.update) { |
| 501 | binding.targetIdx = targetDirectiveIdx; |
| 502 | (updateBindings ??= []).push(binding); |
| 503 | } |
| 504 | } |
| 505 | } |
| 506 | } |
| 507 | } |
| 508 | |
| 509 | const directivesToApply: DirectiveDef<unknown>[] = [componentDef]; |
| 510 | if (directives) { |
| 511 | for (const directive of directives) { |
| 512 | const directiveType = typeof directive === 'function' ? directive : directive.type; |
| 513 | const directiveDef = ngDevMode |
no test coverage detected