37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
|
import { Component, ViewEncapsulation, 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 { RegisterModel } from "../../../models/registers/RegisterModel";
|
||
|
import { RegistryService } from "../../../services/registries/registry.service";
|
||
|
|
||
|
@Component({
|
||
|
selector: 'app-registry-referenced-model-helper',
|
||
|
templateUrl: 'registry-referenced-model-helper.component.html',
|
||
|
styleUrls: ['./registry-referenced-model-helper.component.scss'],
|
||
|
encapsulation: ViewEncapsulation.None
|
||
|
})
|
||
|
export class RegistryReferencedModelHelperComponent implements OnInit {
|
||
|
public formGroup: FormGroup;
|
||
|
|
||
|
constructor(
|
||
|
private registryService: RegistryService,
|
||
|
private route: ActivatedRoute,
|
||
|
public router: Router,
|
||
|
public dialogRef: MatDialogRef<RegistryReferencedModelHelperComponent>,
|
||
|
@Inject(MAT_DIALOG_DATA) public data: any
|
||
|
) { }
|
||
|
|
||
|
ngOnInit(): void {
|
||
|
let registryModel = new RegisterModel();
|
||
|
this.formGroup = registryModel.buildForm();
|
||
|
}
|
||
|
|
||
|
|
||
|
send(value: any) {
|
||
|
this.registryService.create(this.formGroup.value).subscribe(
|
||
|
(item)=> this.dialogRef.close(item)
|
||
|
);
|
||
|
}
|
||
|
}
|