angular2-json-schema-form
Version:
Angular 2 JSON Schema Form builder
56 lines (50 loc) • 1.62 kB
text/typescript
import { Component, Input, OnInit } from '@angular/core';
import { AbstractControl } from '@angular/forms';
import { JsonSchemaFormService } from '../library/json-schema-form.service';
export class SubmitComponent implements OnInit {
private formControl: AbstractControl;
private controlName: string;
private controlValue: any;
private controlDisabled: boolean = false;
private boundControl: boolean = false;
private options: any;
formID: number;
layoutNode: any;
layoutIndex: number[];
dataIndex: number[];
constructor(
private jsf: JsonSchemaFormService
) { }
ngOnInit() {
this.options = this.layoutNode.options;
this.jsf.initializeControl(this);
if (this.controlValue === null || this.controlValue === undefined) {
this.controlValue = this.options.title;
}
}
private updateValue(event) {
if (typeof this.options.onClick === 'function') {
this.options.onClick(event);
} else {
this.jsf.updateValue(this, event.target.value);
}
}
}