| @@ -0,0 +1,10 @@ | |||||
| <div class="modal-header"> | |||||
| <h4 class="modal-title">Hi there!</h4> | |||||
| <button type="button" class="btn-close" aria-label="Close" (click)="activeModal.dismiss('Cross click')"></button> | |||||
| </div> | |||||
| <div class="modal-body"> | |||||
| <ng-container *ngComponentOutlet="dynamicComponent"></ng-container> | |||||
| </div> | |||||
| <div class="modal-footer"> | |||||
| <button type="button" class="btn btn-outline-dark" (click)="activeModal.close('Close click')">Close</button> | |||||
| </div> | |||||
| @@ -0,0 +1,23 @@ | |||||
| import { ComponentFixture, TestBed } from '@angular/core/testing'; | |||||
| import { ModalComponent } from './modal.component'; | |||||
| describe('ModalComponent', () => { | |||||
| let component: ModalComponent; | |||||
| let fixture: ComponentFixture<ModalComponent>; | |||||
| beforeEach(async () => { | |||||
| await TestBed.configureTestingModule({ | |||||
| declarations: [ModalComponent] | |||||
| }) | |||||
| .compileComponents(); | |||||
| fixture = TestBed.createComponent(ModalComponent); | |||||
| component = fixture.componentInstance; | |||||
| fixture.detectChanges(); | |||||
| }); | |||||
| it('should create', () => { | |||||
| expect(component).toBeTruthy(); | |||||
| }); | |||||
| }); | |||||
| @@ -0,0 +1,14 @@ | |||||
| import {Component, Input} from '@angular/core'; | |||||
| import {NgbActiveModal} from "@ng-bootstrap/ng-bootstrap"; | |||||
| @Component({ | |||||
| selector: 'app-modal', | |||||
| templateUrl: './modal.component.html', | |||||
| styleUrl: './modal.component.scss' | |||||
| }) | |||||
| export class ModalComponent { | |||||
| @Input() dynamicComponent: any; | |||||
| constructor(public activeModal: NgbActiveModal) { } | |||||
| } | |||||
| @@ -22,6 +22,8 @@ import {PartnersDetailComponent} from './partners/partners-detail/partners-detai | |||||
| import { ProductsComponent } from './products/products.component'; | import { ProductsComponent } from './products/products.component'; | ||||
| import { ProductsDetailComponent } from './products/products-detail/products-detail.component'; | import { ProductsDetailComponent } from './products/products-detail/products-detail.component'; | ||||
| import { DocumentsComponent } from './documents/documents.component'; | import { DocumentsComponent } from './documents/documents.component'; | ||||
| import { NewContactComponent } from './partners/new-contact/new-contact.component'; | |||||
| import { ModalComponent } from './_components/modal/modal.component'; | |||||
| export function apiConfigFactory(): Configuration { | export function apiConfigFactory(): Configuration { | ||||
| const params: ConfigurationParameters = { | const params: ConfigurationParameters = { | ||||
| @@ -65,7 +67,9 @@ export function HttpLoaderFactory(http: HttpClient) { | |||||
| PartnersDetailComponent, | PartnersDetailComponent, | ||||
| ProductsComponent, | ProductsComponent, | ||||
| ProductsDetailComponent, | ProductsDetailComponent, | ||||
| DocumentsComponent | |||||
| DocumentsComponent, | |||||
| NewContactComponent, | |||||
| ModalComponent | |||||
| ], | ], | ||||
| providers: [ | providers: [ | ||||
| {provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true}, | {provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true}, | ||||
| @@ -0,0 +1,5 @@ | |||||
| <h2>Neuer Kontakt</h2> | |||||
| <div> | |||||
| Hier kommt ein Formular hin! | |||||
| </div> | |||||
| <button>Abschicken</button> | |||||
| @@ -0,0 +1,23 @@ | |||||
| import { ComponentFixture, TestBed } from '@angular/core/testing'; | |||||
| import { NewContactComponent } from './new-contact.component'; | |||||
| describe('NewContactComponent', () => { | |||||
| let component: NewContactComponent; | |||||
| let fixture: ComponentFixture<NewContactComponent>; | |||||
| beforeEach(async () => { | |||||
| await TestBed.configureTestingModule({ | |||||
| declarations: [NewContactComponent] | |||||
| }) | |||||
| .compileComponents(); | |||||
| fixture = TestBed.createComponent(NewContactComponent); | |||||
| component = fixture.componentInstance; | |||||
| fixture.detectChanges(); | |||||
| }); | |||||
| it('should create', () => { | |||||
| expect(component).toBeTruthy(); | |||||
| }); | |||||
| }); | |||||
| @@ -0,0 +1,10 @@ | |||||
| import {Component} from '@angular/core'; | |||||
| @Component({ | |||||
| selector: 'app-new-contact', | |||||
| templateUrl: './new-contact.component.html', | |||||
| styleUrl: './new-contact.component.scss' | |||||
| }) | |||||
| export class NewContactComponent { | |||||
| } | |||||
| @@ -31,7 +31,7 @@ | |||||
| <div class="contacts"> | <div class="contacts"> | ||||
| <div class="d-flex justify-content-between align-items-start"> | <div class="d-flex justify-content-between align-items-start"> | ||||
| <h2>Kontakte</h2> | <h2>Kontakte</h2> | ||||
| <button>Neuer Kontakt</button> | |||||
| <button (click)="openModalNewContact()">Neuer Kontakt</button> | |||||
| </div> | </div> | ||||
| <div class="row"> | <div class="row"> | ||||
| <div class="col-4"> | <div class="col-4"> | ||||
| @@ -1,10 +1,23 @@ | |||||
| import { Component } from '@angular/core'; | |||||
| import {Component} from '@angular/core'; | |||||
| import {NgbModal} from "@ng-bootstrap/ng-bootstrap"; | |||||
| import {ModalComponent} from "@app/_components/modal/modal.component"; | |||||
| import {NewContactComponent} from "@app/partners/new-contact/new-contact.component"; | |||||
| @Component({ | @Component({ | ||||
| selector: 'app-partners-detail', | |||||
| templateUrl: './partners-detail.component.html', | |||||
| styleUrl: './partners-detail.component.scss' | |||||
| selector: 'app-partners-detail', | |||||
| templateUrl: './partners-detail.component.html', | |||||
| styleUrl: './partners-detail.component.scss' | |||||
| }) | }) | ||||
| export class PartnersDetailComponent { | export class PartnersDetailComponent { | ||||
| private closeResult = ''; | |||||
| protected readonly ModalComponent = ModalComponent; | |||||
| constructor(private modalService: NgbModal) { | |||||
| } | |||||
| openModalNewContact() { | |||||
| const modalRef = this.modalService.open(ModalComponent); | |||||
| modalRef.componentInstance.dynamicComponent = NewContactComponent; | |||||
| } | |||||
| ngOnInit() {} | |||||
| } | } | ||||