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