From 64821a14478b21b970e23120089653b917f6727f Mon Sep 17 00:00:00 2001 From: Florian Eisenmenger Date: Fri, 1 Mar 2024 14:30:14 +0100 Subject: [PATCH] modal --- .../contacts/new-contact/new-contact.component.ts | 14 ++++++++++++-- .../partners-detail/partners-detail.component.ts | 6 +++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/matsen-tool/src/app/contacts/new-contact/new-contact.component.ts b/matsen-tool/src/app/contacts/new-contact/new-contact.component.ts index 1cab423..3d4d915 100644 --- a/matsen-tool/src/app/contacts/new-contact/new-contact.component.ts +++ b/matsen-tool/src/app/contacts/new-contact/new-contact.component.ts @@ -1,4 +1,4 @@ -import {Component} from '@angular/core'; +import {Component, Input, OnInit} from '@angular/core'; import {FormGroup} from "@angular/forms"; import {contactForm} from "@app/_forms/apiForms"; import {ContactJsonld, ContactService} from "@app/core/api/v1"; @@ -9,7 +9,9 @@ import {Subscription} from "rxjs"; templateUrl: './new-contact.component.html', styleUrl: './new-contact.component.scss' }) -export class NewContactComponent { +export class NewContactComponent implements OnInit { + @Input() contactId: number | undefined; + protected contactForm: FormGroup; protected selectedImage: File | null; protected contactSub: Subscription; @@ -23,6 +25,14 @@ export class NewContactComponent { this.contactSub = new Subscription(); } + ngOnInit() { + console.log(this.contactId); + } + + getData(meineId: any) { + console.log(meineId); + } + onSubmit() { if (this.contactForm.valid) { // Hier können Sie die Daten senden oder weitere Aktionen durchführen diff --git a/matsen-tool/src/app/partners/partners-detail/partners-detail.component.ts b/matsen-tool/src/app/partners/partners-detail/partners-detail.component.ts index 4538ddc..9491fef 100644 --- a/matsen-tool/src/app/partners/partners-detail/partners-detail.component.ts +++ b/matsen-tool/src/app/partners/partners-detail/partners-detail.component.ts @@ -95,7 +95,11 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit { openModalNewContact() { const modalRef = this.modalService.open(ModalComponent); - modalRef.componentInstance.dynamicComponent = NewContactComponent; + const newContactComponentInstance = new NewContactComponent(this.contactService); + newContactComponentInstance.contactId = 3; + // const newContactComponentInstance = modalRef.componentInstance.dynamicComponent = new NewContactComponent(this.contactService); + //newContactComponentVar.getData(3); + modalRef.componentInstance.dynamicComponent = newContactComponentInstance; } openModalNewPosting() {