angular2-json-schema-form
Version:
Angular 2 JSON Schema Form builder
71 lines (65 loc) • 2.33 kB
text/typescript
import { Component, Input, OnInit } from '@angular/core';
import { AbstractControl } from '@angular/forms';
import { JsonSchemaFormService } from '../../library/json-schema-form.service';
import { buildTitleMap } from '../../library/utilities/index';
export class MaterialRadiosComponent implements OnInit {
private formControl: AbstractControl;
private controlName: string;
private controlValue: any;
private controlDisabled: boolean = false;
private boundControl: boolean = false;
private options: any;
private layoutOrientation: string = 'vertical';
private radiosList: any[] = [];
formID: number;
layoutNode: any;
layoutIndex: number[];
dataIndex: number[];
constructor(
private jsf: JsonSchemaFormService
) { }
ngOnInit() {
this.options = this.layoutNode.options;
if (this.layoutNode.type === 'radios-inline' ||
this.layoutNode.type === 'radiobuttons'
) {
this.layoutOrientation = 'horizontal';
}
this.radiosList = buildTitleMap(
this.options.titleMap || this.options.enumNames,
this.options.enum, true
);
this.jsf.initializeControl(this);
}
private updateValue(value) {
this.jsf.updateValue(this, value);
}
}