Create nested dialog in EJ2 TypeScript Dialog control

A Dialog can be nested within another Dialog. The below sample contains parent and child Dialog (inner Dialog).

Step 1:

Create two div elements with id #dialog and #innerDialog.

Step 2:

Initialize the Dialog as mentioned in the below sample.

Step 3:

Set the inner Dialog target as #dialog.

import { Dialog } from '@syncfusion/ej2-popups';
import { enableRipple } from '@syncfusion/ej2-base';

enableRipple(true);

// Initialize the Outer Dialog component
let dialog = new Dialog({
    // Enables the header
    header: 'Outer Dialog',
    // Enables the close icon button in header
    showCloseIcon: true,
    // The Dialog shows within the target element
    target: document.getElementById("container"),
    // Dialog content
    content: document.getElementById("dlgContent"),
    //Dialog height
    height: '300px',
    animationSettings: { effect: 'None' },
    // Disable the Esc key option to hide the Dialog
    closeOnEscape: false,
    //Dialog width
    width: '400px',
    // Dialog beforeOpen event
    beforeOpen: onBeforeopen
});
// Render initialized outer Dialog
dialog.appendTo('#dialog');

// Sample level code to handle the button click action
document.getElementById('targetButton').onclick = (): void => {
    // Call the show method to open the Dialog
    dialog.show();
}

// initialize the Inner Dialog component
let innerDialog = new Dialog({
    // Enables the header
    header: 'Inner Dialog',
    // Enables the close icon button in header
    showCloseIcon: true,
    animationSettings: { effect: 'None'},
    // Disable the Esc key option to hide the Dialog
    closeOnEscape: false,
    // Dialog content
    content: 'This is a Nested Dialog',
    // InnerDialog target as outerDialog
    target: document.getElementById("dialog"),
    // Dialog height
    height: '150px',
    // Dialog Width
    width: '250px'
});

document.getElementById('innerButton').onclick = (): void => {
    // Call the show method to open the Dialog
    innerDialog.show();
}
// Render initialized inner Dialog
innerDialog.appendTo('#innerDialog');

function onBeforeopen(): void {
    document.getElementById('dlgContent').style.visibility = 'visible';
}
<!DOCTYPE html>
<html lang="en">

<head>
    <title>Essential JS 2 Nested Dialog</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="TypeScript UI Components" />
    <meta name="author" content="Syncfusion" />
    <link href="styles.css" rel="stylesheet" />
    <link href="https://cdn.syncfusion.com/ej2/25.1.35/ej2-base/styles/material.css" rel="stylesheet" />
    <link href="https://cdn.syncfusion.com/ej2/25.1.35/ej2-buttons/styles/material.css" rel="stylesheet" />
    <link href="https://cdn.syncfusion.com/ej2/25.1.35/ej2-popups/styles/material.css" rel="stylesheet" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
    <script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>

<body>
    <div id='loader'>LOADING....</div>
    <div id='container'>
        <button class="e-control e-btn" id="targetButton" role="button">Open Dialog</button>
        <div id='dialog'>
        </div>
        <div id='innerDialog'></div>
        <div id="dlgContent" style="visibility: hidden">
            <button class="e-control e-btn" id="innerButton" role="button">Open InnerDialog</button>
        </div>
    </div>
</body>
</html>