File

projects/cobbler-frontend/src/app/common/dialog-item-copy/dialog-item-copy.component.ts

Metadata

Index

Properties
Methods

Constructor

constructor(data: DialogItemCopyData)
Parameters :
Name Type Optional
data DialogItemCopyData No

Methods

onNoClick
onNoClick()
Returns : void

Properties

Public data
Type : DialogItemCopyData
Decorators :
@Inject(MAT_DIALOG_DATA)
Readonly dialogCloseSignal
Default value : model('')
Readonly dialogRef
Default value : inject(MatDialogRef<DialogItemCopyComponent>)
import {
  ChangeDetectionStrategy,
  Component,
  inject,
  Inject,
  model,
} from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button';
import {
  MAT_DIALOG_DATA,
  MatDialogModule,
  MatDialogRef,
} from '@angular/material/dialog';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';

export interface DialogItemCopyData {
  itemType: string;
  itemName: string;
  itemUid: string;
}

@Component({
  selector: 'cobbler-dialog-item-copy',
  standalone: true,
  imports: [
    MatDialogModule,
    MatButtonModule,
    ReactiveFormsModule,
    MatFormFieldModule,
    MatInputModule,
    FormsModule,
  ],
  templateUrl: './dialog-item-copy.component.html',
  styleUrl: './dialog-item-copy.component.scss',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class DialogItemCopyComponent {
  readonly dialogRef = inject(MatDialogRef<DialogItemCopyComponent>);
  readonly dialogCloseSignal = model('');

  constructor(@Inject(MAT_DIALOG_DATA) public data: DialogItemCopyData) {}

  onNoClick(): void {
    this.dialogRef.close();
  }
}
<h1 mat-dialog-title>Copy {{ data.itemType }}</h1>
<mat-dialog-content>
  <mat-form-field class="form-field-full-width">
    <mat-label>Old name</mat-label>
    <input matInput readonly value="{{ data.itemName }}" />
  </mat-form-field>

  <mat-form-field class="form-field-full-width">
    <mat-label>New name</mat-label>
    <input
      matInput
      [(ngModel)]="dialogCloseSignal"
      cdkFocusInitial
      placeholder="New name"
    />
  </mat-form-field>
</mat-dialog-content>
<mat-dialog-actions>
  <button mat-button (click)="onNoClick()">Close</button>
  <button mat-button [mat-dialog-close]="dialogCloseSignal()">Copy</button>
</mat-dialog-actions>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""