( rootSelectorOrNode: any, componentDef: ComponentDef<unknown>, componentBindings: Binding[] | undefined, directives: (Type<unknown> | DirectiveWithBindings<unknown>)[] | undefined, )
| 418 | } |
| 419 | |
| 420 | function createRootTView( |
| 421 | rootSelectorOrNode: any, |
| 422 | componentDef: ComponentDef<unknown>, |
| 423 | componentBindings: Binding[] | undefined, |
| 424 | directives: (Type<unknown> | DirectiveWithBindings<unknown>)[] | undefined, |
| 425 | ): TView { |
| 426 | const tAttributes = rootSelectorOrNode |
| 427 | ? ['ng-version', '0.0.0-PLACEHOLDER'] |
| 428 | : // Extract attributes and classes from the first selector only to match VE behavior. |
| 429 | extractAttrsAndClassesFromSelector(componentDef.selectors[0]); |
| 430 | let creationBindings: Binding[] | null = null; |
| 431 | let updateBindings: Binding[] | null = null; |
| 432 | let varsToAllocate = 0; |
| 433 | |
| 434 | if (componentBindings) { |
| 435 | for (const binding of componentBindings as BindingInternal[]) { |
| 436 | varsToAllocate += binding[BINDING].requiredVars; |
| 437 | |
| 438 | if (binding.create) { |
| 439 | (binding as BindingInternal).targetIdx = 0; |
| 440 | (creationBindings ??= []).push(binding); |
| 441 | } |
| 442 | |
| 443 | if (binding.update) { |
| 444 | (binding as BindingInternal).targetIdx = 0; |
| 445 | (updateBindings ??= []).push(binding); |
| 446 | } |
| 447 | } |
| 448 | } |
| 449 | |
| 450 | if (directives) { |
| 451 | for (let i = 0; i < directives.length; i++) { |
| 452 | const directive = directives[i]; |
| 453 | if (typeof directive !== 'function') { |
| 454 | for (const binding of directive.bindings as BindingInternal[]) { |
| 455 | varsToAllocate += binding[BINDING].requiredVars; |
| 456 | const targetDirectiveIdx = i + 1; |
| 457 | if (binding.create) { |
| 458 | (binding as BindingInternal).targetIdx = targetDirectiveIdx; |
| 459 | (creationBindings ??= []).push(binding); |
| 460 | } |
| 461 | |
| 462 | if (binding.update) { |
| 463 | (binding as BindingInternal).targetIdx = targetDirectiveIdx; |
| 464 | (updateBindings ??= []).push(binding); |
| 465 | } |
| 466 | } |
| 467 | } |
| 468 | } |
| 469 | } |
| 470 | |
| 471 | const directivesToApply: DirectiveDef<unknown>[] = [componentDef]; |
| 472 | if (directives) { |
| 473 | for (const directive of directives) { |
| 474 | const directiveType = typeof directive === 'function' ? directive : directive.type; |
| 475 | const directiveDef = ngDevMode |
| 476 | ? getDirectiveDefOrThrow(directiveType) |
| 477 | : getDirectiveDef(directiveType)!; |
no test coverage detected