26 lines
785 B
TypeScript
26 lines
785 B
TypeScript
import { Component, ElementRef, Inject, OnInit, ViewChild } from '@angular/core';
|
|
import {MatDialog, MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';
|
|
import { DashboardCreationData } from 'src/app/dashboard.service';
|
|
|
|
@Component({
|
|
selector: 'app-new-dashboard',
|
|
templateUrl: './new-dashboard.component.html',
|
|
styleUrls: ['./new-dashboard.component.scss']
|
|
})
|
|
export class NewDashboardComponent implements OnInit {
|
|
|
|
@ViewChild('name') nameInput!: ElementRef;
|
|
|
|
constructor(public dialogRef: MatDialogRef<NewDashboardComponent>,
|
|
@Inject(MAT_DIALOG_DATA) public data: DashboardCreationData,){
|
|
}
|
|
|
|
ngOnInit(): void {
|
|
window.setTimeout(() => this.nameInput.nativeElement.focus(), 0);
|
|
}
|
|
|
|
onSaveClick(): void {
|
|
this.dialogRef.close(this.data);
|
|
}
|
|
}
|