File

src/app/shared/components/modal/modal.component.ts

Metadata

selector cd-modal
styleUrls ./modal.component.scss
templateUrl ./modal.component.html

Index

Methods
Inputs
Outputs

Constructor

constructor()

Inputs

modalRef
Type : BsModalRef

Outputs

hide
Type : EventEmitter

Should be a function that is triggered when the modal is hidden.

Methods

close
close()
Returns : void
import { Component, EventEmitter, Input, Output } from '@angular/core';

import { BsModalRef } from 'ngx-bootstrap/modal';

@Component({
  selector: 'cd-modal',
  templateUrl: './modal.component.html',
  styleUrls: ['./modal.component.scss']
})
export class ModalComponent {
  @Input()
  modalRef: BsModalRef;

  /**
   * Should be a function that is triggered when the modal is hidden.
   */
  @Output()
  hide = new EventEmitter();

  constructor() {}

  close() {
    if (this.modalRef) {
      this.modalRef.hide();
    }
    this.hide.emit();
  }
}
<div class="modal-header">
  <h4 class="modal-title pull-left">
    <ng-content select=".modal-title"></ng-content>
  </h4>
  <button type="button"
          class="close pull-right"
          aria-label="Close"
          (click)="close()">
    <span aria-hidden="true">&times;</span>
  </button>
</div>

<ng-content select=".modal-content"></ng-content>

./modal.component.scss

@import '../../../../defaults';

.modal-header {
  @include hf;
  border-radius: 5px 5px 0 0;
}

::ng-deep .modal-footer {
  @include hf;
  border-radius: 0 0 5px 5px;
}

::ng-deep .modal-body {
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: hidden;
}
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""