GitHub

DaffModalComponent

import { DaffModalComponent } from '@daffodil/design/modal'

@Component()
class DaffModalComponent implements AfterContentInit, AfterViewInit, DaffOpenable {
  @HostBinding() modalClass: boolean = true
  @HostBinding() role: string = 'dialog'
  @HostBinding() ariaModal: boolean = true
  @HostBinding() ariaLabelledBy: string
  animationCompleted: EventEmitter<any> = new EventEmitter<any>()
  closedAnimationCompleted: EventEmitter<any> = new EventEmitter<
      any
    >()
  @HostBinding() 
  get fadeState(): string
  get open(): boolean

  ngAfterContentInit(): void
  ngAfterViewInit(): void
  attachContent(portal: ComponentPortal<any>): any
  @HostListener() animationDone(e: AnimationEvent_2): void
  reveal(): void
  hide(): void
  toggle(): void
}

Properties

modalClass
boolean
Defaulttrue
Description

Sets a class of .daff-modal to the host element.

role
string
Default'dialog'
Description

Sets the role to dialog.

ariaModal
boolean
Defaulttrue
Description

Sets aria-modal to true.

ariaLabelledBy
string
Default
Description

The aria-labelledby for the modal. This is set by the id of DaffModalTitleDirective when it is used.

animationCompleted
EventEmitter<any>
Defaultnew EventEmitter<any>()
Description

Event fired when the close animation is completed.

closedAnimationCompleted
EventEmitter<any>
Defaultnew EventEmitter< any >()
Description

Event fired when the close animation is completed.

fadeState
string
Default
Description

Animation hook that controls the entrance and exit animations of the modal.

open
boolean
Default
Description

() Methods

ngAfterContentInit
void
ngAfterViewInit
void
attachContent
any

Helper method to attach portable content to modal.

Parameters
Parameterportal: ComponentPortal
Description
animationDone
void

Animation event that can used to hook into when animations are fully completed. We use this in the DaffModalService to determine when to actually remove the dynamically rendered element from the DOM so that the animation does not clip as the element is removed.

Parameters
Parametere: AnimationEvent_2
Description
reveal
void

Reveals the modal

hide
void

Hides the modal

toggle
void

Toggles the visibility of the modal