Update template-list-dialog.component.ts

This commit is contained in:
piotrpekala7 2020-02-24 13:49:31 +01:00
parent e11281ddf6
commit f40b2c64c2

View File

@ -9,6 +9,7 @@ import { Template } from '../../../models/template';
import { FormBuilder, FormGroup, FormControl, Validators } from '@angular/forms';
import { ToasterService } from '../../../services/toaster.service';
import { Project } from '../../../models/project';
import { NonNegativeValidator } from '../../../validators/non-negative-validator';
@Component({
selector: 'app-template-list-dialog',
@ -34,13 +35,14 @@ export class TemplateListDialogComponent implements OnInit {
private templateService: TemplateService,
private formBuilder: FormBuilder,
@Inject(MAT_DIALOG_DATA) public data: any,
private toasterService: ToasterService
private toasterService: ToasterService,
private nonNegativeValidator: NonNegativeValidator,
) {
this.server = data['server'];
this.project = data['project'];
this.configurationForm = this.formBuilder.group({
name: new FormControl('new node', Validators.required),
numberOfNodes: new FormControl(1, Validators.required)
numberOfNodes: new FormControl(1, [Validators.required, nonNegativeValidator.get])
});
this.positionForm = this.formBuilder.group({
top: new FormControl(0, Validators.required),