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

Class LegacyParsingInput

packages/forms/signals/test/web/interop.spec.ts:1288–1308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1286 // --- 1. Component Setup ---
1287 // An FVC custom control designed for Signal Forms, used inside a legacy template-driven `ngModel`.
1288 @Component({
1289 selector: 'legacy-parsing-input',
1290 template: `<input #i [value]="rawValue()" (input)="rawValue.set(i.value)" />`,
1291 })
1292 class LegacyParsingInput {
1293 readonly value = model<number | null>(null);
1294 protected readonly rawValue = transformedValue(this.value, {
1295 parse: (val) => {
1296 if (val === '') return {value: null};
1297 const num = Number(val);
1298 if (Number.isNaN(num)) {
1299 return {error: {kind: 'parse', message: `${val} is not numeric`}};
1300 }
1301 return {value: num};
1302 },
1303 format: (val) => val?.toString() ?? '',
1304 });
1305 getRawValueSignal() {
1306 return this.rawValue;
1307 }
1308 }
1309
1310 @Component({
1311 template: `<legacy-parsing-input [(ngModel)]="val" #model="ngModel" />`,

Callers

nothing calls this directly

Calls 3

ComponentInterface · 0.90
transformedValueFunction · 0.90
toStringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…