import { AbstractControl } from '@angular/forms'; import { Component, Input, OnInit } from '@angular/core'; import { JsonSchemaFormService } from '../../json-schema-form.service'; @Component({ // tslint:disable-next-line:component-selector selector: 'material-slider-widget', template: ` `, styles: [` mat-error { font-size: 75%; } `], }) export class MaterialSliderComponent implements OnInit { formControl: AbstractControl; controlName: string; controlValue: any; controlDisabled = false; boundControl = false; options: any; allowNegative = true; allowDecimal = true; allowExponents = false; lastValidNumber = ''; @Input() layoutNode: any; @Input() layoutIndex: number[]; @Input() dataIndex: number[]; constructor( private jsf: JsonSchemaFormService ) { } ngOnInit() { this.options = this.layoutNode.options || {}; this.jsf.initializeControl(this, !this.options.readonly); } updateValue(event) { this.options.showErrors = true; this.jsf.updateValue(this, event.value); } }