angular2-json-schema-form
Version:
Angular 2 JSON Schema Form builder
52 lines (46 loc) • 1.54 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 MaterialCheckboxComponent implements OnInit {
private formControl: AbstractControl;
private controlName: string;
private controlValue: any;
private controlDisabled: boolean = false;
private boundControl: boolean = false;
private options: any;
private trueValue: any = true;
private falseValue: any = false;
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) {
this.jsf.updateValue(this, event.checked ? this.trueValue : this.falseValue);
}
}