Last active
July 21, 2021 17:02
-
-
Save keithstric/f23d147b75eeda7bfb5080b2d13f714e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Show a very simple dialog | |
const textModalConfig = { | |
modalTitle: 'A reusable modal dialog', | |
modalTextContent: 'Here is the body of the dialog', | |
data: {foo: 'bar'}, | |
confirmButtonLabel: 'Roger that!', | |
confirmHandler: (data) => { | |
console.log('Modal confirm handler', data); | |
}, | |
cancelHandler: () => { | |
console.log('Modal cancel handler'); | |
} | |
}; | |
const modalRef = NotificationService.showConfirmDialog(textModalConfig); | |
// Show a template as the body | |
const txt = 'Some TEXT' | |
const cancelHandler = () => { | |
console.log('Modal cancel handler'); | |
}; | |
@ViewChild('someTemplate') someTemplate: TemplateRef<any>; | |
const templateModalConfig = { | |
modalTitleHtml: `<div>${txt}</div>`, | |
modalTemplateContent: someTemplate, | |
data: {foo: 'bar'}, | |
confirmButtonLabel: 'Roger that!', | |
confirmHandler: (data) => { | |
console.log('Modal confirm handler', data); | |
}, | |
cancelHandler: cancelHandler.bind(this) | |
}; | |
const modalRef = NotificationService.showConfirmDialog(templateModalConfig); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment