import { Component, Inject, OnChanges, OnInit, SimpleChanges } from '@angular/core'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { ConstFormColor, ConstFormStyle, IFormBuilderCell } from '../../../models/control'; @Component({ selector: 'dr-set-button-link', templateUrl: './set-button-link.component.html', styleUrls: ['./set-button-link.component.scss'] }) export class SetButtonLinkComponent implements OnInit { formColors = ConstFormColor; formStyles = ConstFormStyle; showFormTable = true; control: IFormBuilderCell; linkObj: { link?: string, newPage?: boolean, buttonColor?: string, buttonStyle?: string }; constructor( public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data: IFormBuilderCell) { this.control = data; } ngOnInit(): void { this.linkObj = { ...this.control }; } onSubmit(): void { this.control = { ...this.control, ...this.linkObj }; this.dialogRef.close(this.control); } }