form validation for new dashboard dialog
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Component, ElementRef, Inject, OnInit, ViewChild } from '@angular/core';
|
||||
import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';
|
||||
import { DashboardCreationData } from 'src/app/dashboard.service';
|
||||
import { AbstractControl, FormControl, FormGroup, ValidationErrors, ValidatorFn, Validators } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'app-new-dashboard',
|
||||
@@ -8,6 +9,12 @@ import { DashboardCreationData } from 'src/app/dashboard.service';
|
||||
})
|
||||
export class NewDashboardComponent implements OnInit {
|
||||
|
||||
|
||||
registerForm = new FormGroup({
|
||||
name: new FormControl('', [Validators.pattern(/^[^\s]+.{0,63}$/), Validators.required]),
|
||||
description: new FormControl('', [Validators.maxLength(65535)]),
|
||||
});
|
||||
|
||||
@ViewChild('name') nameInput!: ElementRef;
|
||||
|
||||
constructor(public dialogRef: MatDialogRef<NewDashboardComponent>,
|
||||
|
||||
Reference in New Issue
Block a user