Skip to content

Class: ConfirmBoxInitializer

Boris Jenicek edited this page Dec 20, 2021 · 4 revisions

Class: ConfirmBoxInitializer

This is the class that needs to be instantiated to set up and ignite a ConfirmBox and create content. Its purpose is to get confirmation response from end-user. It can be called from any angular typescript file.

Below is example with (some optional) user configuration, it will override default configuration from app.module.

Example:

// Create the initializer.
const newConfirmBox = new ConfirmBoxInitializer();

// Set desired dispatch: _Title: string, _Message: string.
newConfirmBox.setDispatch('Are you sure?', 'That action will delete user!');

// Set desired configuration.
newConfirmBox.setConfig({
     layoutType: DialogLayoutDisplay.DANGER
  });

// Set button labels.
newConfirmBox.setButtonLabels('YES', 'NO');

// Open a ConfirmBox, and get clicked button-id in response.
newConfirmBox.openConfirmBox$().subscribe(resp => {
  // IConfirmBoxPublicResponse
  console.log('confirmBox response: ', resp);
 });

Constructors

constructor

+ new ConfirmBoxInitializer(): ConfirmBoxInitializer

Returns: ConfirmBoxInitializer

Methods

openConfirmBox$

openConfirmBox$(): Observable<IConfirmBoxPublicResponse>

Returns: Observable<IConfirmBoxPublicResponse>


setButtonLabels

setButtonLabels(_Confirm: string, _Decline?: string): void

Parameters:

Name Type
_Confirm string
_Decline? string

Returns: void


setButtons

setButtons(_Buttons: IButton[]): void

Parameters:

Name Type
_Buttons IButton[]

Returns: void


setConfig

setConfig(_ConfirmBoxCoreConfig: IConfirmBoxCoreConfig): void

Parameters:

Name Type
_ConfirmBoxCoreConfig IConfirmBoxCoreConfig

Returns: void


setDispatch

setDispatch(_Title: string, _Message?: string): void

Parameters:

Name Type Default value
_Title string -
_Message string null

Returns: void


setMessage

setMessage(_Message: string): void

Parameters:

Name Type
_Message string

Returns: void


setTitle

setTitle(_Title: string): void

Parameters:

Name Type
_Title string

Returns: void

Clone this wiki locally