MCPcopy Create free account
hub / github.com/eclipsesource/jsonforms / ngOnInit

Function ngOnInit

packages/angular/src/library/abstract-control.ts:102–140  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

100 }
101
102 ngOnInit() {
103 this.addSubscription(
104 this.jsonFormsService.$state.subscribe({
105 next: (state: JsonFormsState) => {
106 const props = this.mapToProps(state);
107 const {
108 data,
109 enabled,
110 errors,
111 label,
112 required,
113 schema,
114 rootSchema,
115 visible,
116 path,
117 config,
118 } = props;
119 this.label = computeLabel(
120 label,
121 required,
122 config ? config.hideRequiredAsterisk : false
123 );
124 this.data = data;
125 this.error = errors;
126 this.enabled = enabled;
127 this.isEnabled() ? this.form.enable() : this.form.disable();
128 this.hidden = !visible;
129 this.scopedSchema = schema;
130 this.rootSchema = rootSchema;
131 this.description = props.description ?? '';
132 this.id = props.id;
133 this.form.setValue(data);
134 this.propsPath = path;
135 this.mapAdditionalProps(props);
136 },
137 })
138 );
139 this.triggerValidation();
140 }
141
142 validator: ValidatorFn = (_c: AbstractControl): ValidationErrors | null => {
143 return this.error ? { error: this.error } : null;

Callers

nothing calls this directly

Calls 5

computeLabelFunction · 0.90
addSubscriptionMethod · 0.80
subscribeMethod · 0.80
mapToPropsMethod · 0.45
mapAdditionalPropsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…