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

Function assertControlPresent

packages/forms/src/model/abstract_model.ts:267–282  ·  view source on GitHub ↗
(parent: any, isGroup: boolean, key: string | number)

Source from the content-addressed store, hash-verified

265}
266
267export function assertControlPresent(parent: any, isGroup: boolean, key: string | number): void {
268 const controls = parent.controls as {[key: string | number]: AbstractControl<any>};
269 const collection = isGroup ? Object.keys(controls) : controls;
270 if (!collection.length) {
271 throw new RuntimeError(
272 RuntimeErrorCode.NO_CONTROLS,
273 typeof ngDevMode === 'undefined' || ngDevMode ? noControlsError(isGroup) : '',
274 );
275 }
276 if (!hasOwnControl(controls, key)) {
277 throw new RuntimeError(
278 RuntimeErrorCode.MISSING_CONTROL,
279 typeof ngDevMode === 'undefined' || ngDevMode ? missingControlError(isGroup, key) : '',
280 );
281 }
282}
283
284export function assertAllValuesPresent(control: any, isGroup: boolean, value: any): void {
285 control._forEachChild((_: unknown, key: string | number) => {

Callers 2

setValueMethod · 0.90
setValueMethod · 0.90

Calls 4

noControlsErrorFunction · 0.90
missingControlErrorFunction · 0.90
hasOwnControlFunction · 0.85
keysMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…