MCPcopy Create free account
hub / github.com/angular/angular / applyWhen

Function applyWhen

packages/forms/signals/src/api/structure.ts:338–347  ·  view source on GitHub ↗
(
  path: SchemaPath<TValue>,
  logic: LogicFn<TValue, boolean>,
  schema: NoInfer<SchemaOrSchemaFn<TValue>>,
)

Source from the content-addressed store, hash-verified

336 * @publicApi 22.0
337 */
338export function applyWhen<TValue>(
339 path: SchemaPath<TValue>,
340 logic: LogicFn<TValue, boolean>,
341 schema: NoInfer<SchemaOrSchemaFn<TValue>>,
342): void {
343 assertPathIsCurrent(path);
344
345 const pathNode = FieldPathNode.unwrapFieldPath(path);
346 pathNode.mergeIn(SchemaImpl.create(schema), {fn: logic, path});
347}
348
349/**
350 * Conditionally applies a predefined schema to a given `FieldPath`.

Callers 5

path.spec.tsFile · 0.85
resource.spec.tsFile · 0.85
when.spec.tsFile · 0.85
applyWhenValueFunction · 0.85

Calls 4

assertPathIsCurrentFunction · 0.90
unwrapFieldPathMethod · 0.80
createMethod · 0.65
mergeInMethod · 0.45

Tested by

no test coverage detected