MCPcopy Index your code
hub / github.com/angular/angular / isNativeField

Function isNativeField

packages/compiler/src/typecheck/ops/signal_forms.ts:380–402  ·  view source on GitHub ↗
(
  dir: TcbDirectiveMetadata,
  node: Node,
  allDirectiveMatches: TcbDirectiveMetadata[],
)

Source from the content-addressed store, hash-verified

378
379/** Determines if a directive usage is on a native field. */
380export function isNativeField(
381 dir: TcbDirectiveMetadata,
382 node: Node,
383 allDirectiveMatches: TcbDirectiveMetadata[],
384): node is Element & {name: 'input' | 'select' | 'textarea'} {
385 // Only applies to the `FormField` directive.
386 if (!isFieldDirective(dir)) {
387 return false;
388 }
389
390 // Only applies to input, select and textarea elements.
391 if (
392 !(node instanceof Element) ||
393 (node.name !== 'input' && node.name !== 'select' && node.name !== 'textarea')
394 ) {
395 return false;
396 }
397
398 // Only applies if there are no custom fields or ControlValueAccessors.
399 return allDirectiveMatches.every((meta) => {
400 return getCustomFieldDirectiveType(meta) === null && !isControlValueAccessorLike(meta);
401 });
402}
403
404/**
405 * Determines if a directive is shaped like a `ControlValueAccessor`. Note that this isn't

Callers 1

appendDirectiveInputsMethod · 0.90

Calls 3

isFieldDirectiveFunction · 0.85

Tested by

no test coverage detected