import { ViewEncapsulation, Component, OnInit, Inject } from "@angular/core"; import { FormGroup } from "@angular/forms"; import { ActivatedRoute, Router } from "@angular/router"; import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material"; import { ServiceModel } from "../../../models/services/ServiceModel"; import { ServicesDataService } from "../../../services/services/services-data.service"; @Component({ selector: 'app-services-referenced-model-helper', templateUrl: 'services-referenced-model-helper.component.html', styleUrls: ['./services-referenced-model-helper.component.scss'], encapsulation: ViewEncapsulation.None }) export class ServicesReferencedModelHelperComponent implements OnInit { public formGroup: FormGroup; constructor( private registryService: ServicesDataService, private route: ActivatedRoute, public router: Router, public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data: any ) { } ngOnInit(): void { let serviceModel = new ServiceModel(); this.formGroup = serviceModel.buildForm(); } send() { this.registryService.create(this.formGroup.value).subscribe( (item)=> this.dialogRef.close(item) ); } }