MediaSFU Angular
    Preparing search index...

    Class PollModal

    PollModal - Modal for creating, voting, and managing live polls

    Allows hosts to create/end polls and participants to vote on active polls. Supports multiple-choice questions with real-time result updates.

    Supports three levels of customization:

    1. Basic Usage: Use default modal UI with poll creation/voting forms
    2. Style Customization: Override modal appearance with overlayStyle and contentStyle
    3. Full Override: Provide a custom template via customTemplate for complete control

    Key Features:

    • Create polls with question and options (host only)
    • Vote on active polls (all participants)
    • View poll results in real-time
    • End active polls (host only)
    • Socket-based live updates

    app-poll-modal

    true

    CommonModule, FontAwesomeModule, FormsModule

    isPollModalVisible - Whether the modal is currently visible. Default: false

    onClose - Callback function to close the modal. Default: () => {}

    position - Modal position on screen ('topRight', 'center', etc.). Default: 'topRight'

    backgroundColor - Background color of the modal content. Default: '#83c0e9'

    member - Name/ID of current participant. Default: ''

    islevel - User level/role ('0' for host, '2' for participant). Default: '2'

    polls - Array of all poll objects. Default: []

    poll - Currently active poll object. Default: null

    socket - Socket.io client instance for real-time communication. Default: undefined

    roomName - Name of the room/session. Default: ''

    showAlert - Optional alert function for displaying messages. Default: undefined

    updateIsPollModalVisible - Function to update modal visibility. Default: () => {}

    handleCreatePoll - Function to create new poll. Default: () => {}

    handleEndPoll - Function to end active poll. Default: () => {}

    handleVotePoll - Function to submit vote. Default: () => {}

    overlayStyle - Custom CSS styles for the modal overlay backdrop. Default: undefined

    contentStyle - Custom CSS styles for the modal content container. Default: undefined

    customTemplate - Custom TemplateRef to completely replace default modal template. Default: undefined

    ngOnInit - Initializes component state

    ngOnChanges - Updates poll state when inputs change

    getCombinedOverlayStyle - Merges default and custom overlay styles

    getCombinedContentStyle - Merges default and custom content styles

    Implements

    • OnInit
    • OnChanges
    Index

    Accessors

    • get modalContainerStyle(): {
          position: string;
          top: number;
          left: number;
          width: string;
          height: string;
          backgroundColor: string;
          display: string;
          zIndex: number;
      }

      Returns {
          position: string;
          top: number;
          left: number;
          width: string;
          height: string;
          backgroundColor: string;
          display: string;
          zIndex: number;
      }

    • get modalContentStyle(): {
          position: string;
          backgroundColor: string;
          borderRadius: string;
          padding: string;
          width: string;
          maxHeight: string;
          overflowY: string;
          top: string;
          bottom: string;
          left: string;
          right: string;
      }

      Returns {
          position: string;
          backgroundColor: string;
          borderRadius: string;
          padding: string;
          width: string;
          maxHeight: string;
          overflowY: string;
          top: string;
          bottom: string;
          left: string;
          right: string;
      }

    Constructors

    Methods

    • A callback method that is invoked immediately after the default change detector has checked the directive's data-bound properties for the first time, and before any of the view or content children have been checked. It is invoked only once when the directive is instantiated.

      Returns void

    • A callback method that is invoked immediately after the default change detector has checked data-bound properties if at least one has changed, and before the view and content children are checked.

      Parameters

      • changes: SimpleChanges

        The changed properties.

      Returns void

    Properties

    isPollModalVisible: boolean = false
    onClose: () => void
    position: string = 'topRight'
    backgroundColor: string = '#f5f5f5'
    member: string = ''
    islevel: string = ''
    polls: Poll[] = []
    poll: Poll | null = null
    socket: Socket = ...
    roomName: string = ''
    showAlert: ShowAlert = ...
    updateIsPollModalVisible: (isVisible: boolean) => void = ...
    handleCreatePoll: HandleCreatePollType
    handleEndPoll: HandleEndPollType
    handleVotePoll: HandleVotePollType
    overlayStyle?: Partial<CSSStyleDeclaration>
    contentStyle?: Partial<CSSStyleDeclaration>
    customTemplate?: any
    faTimes: IconDefinition = faTimes
    newPoll: any = ...
    screenWidth: number = window.innerWidth
    modalWidth: number = ...