
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
ngx-modal-dialog
Advanced tools
Dynamic modal dialog for Angular that does not sit on DOM waiting to be triggered, but rather gets injected upon need.
Made with Bootstrap 4 styles in mind, but configurable to any framework or custom set of styles
npm install --save ngx-modal-dialog
Modal dialog uses ComponentFactoryResolver
to inject the given child component to the dialog.
ModalDialogService makes sure that only one instance of a modal dialog is opened at a time.
With IModalDialogOptions you can define which component will be rendered inside the dialog and configure it based on your needs.
You can further use action buttons to control modal dialog from external component or child component. If action performed on button click is successful, modal dialog will close. Otherwise it will alert user.
Ngx-modal-dialog
is intended to be used with Bootstrap 4, however you can apply your custom styles from your desired UI framework by providing class names in IModalDialogSettings.
ngx-modal
module in your application at any place. The recommended way is to add forRoot
initialization in the main app module.import { BrowserModule } from '@angular/platform-browser';
import { ModalDialogModule } from '@greentube/ngx-modal';
@NgModule({
imports: [
BrowserModule,
ModalDialogModule.forRoot()
],
bootstrap: [AppComponent]
})
export class AppModule { }
Create a custom component that implements IModalDialog
or use the SimpleModalDialog
as a child component.
Inject the ModalDialogService
where you want to open the dialog. Call openDialog
passing parent ViewContainerRef
and IModalDialogOptions
:
constructor(modalService: ModalDialogService, viewRef: ViewContainerRef) { }
openNewDialog() {
this.modalService.openDialog(this.viewRef, {
title: 'Some modal title',
childComponent: SimpleModalComponent
});
}
actionButtons
in modal dialog options or child component to control modal dialog.class MyModalComponent implements IModalDialog {
actionButtons: IModalDialogButton[];
constructor() {
this.actionButtons = [
{ text: 'Close' }, // no special processing here
{ text: 'I will always close', onAction: () => true },
{ text: 'I never close', onAction: () => false }
];
}
dialogInit(reference: ComponentRef<IModalDialog>, options?: IModalDialogOptions) {
// no processing needed
}
}
openDialog(target: ViewContainerRef, dialogOptions?: IModalDialogOptions)
: Closes existing and opens a new modal dialog according to IModalDialogOptions.Every component that is used as modal dialog must implement IModalDialog
.
dialogInit(reference: ComponentRef<IModalDialog>, options?: IModalDialogOptions) => void
true
actionButtons
false
string
interface IModalDialogOptions {
title?: string;
childComponent?: any;
onClose?: () => Promise<any> | Observable<any> | boolean;
actionButtons?: IModalDialogButton[];
data?: any;
settings?: IModalDialogSettings;
}
title
Mandatory: false
Default: -
Type: string
Modal heading text
childComponent
Mandatory: false
Default: -
Type: any
Component type that will be rendered as a content of modal dialog. Component must implement IModalDialog
interface.
onClose()
Mandatory: false
Default: -
Type: function
Input: -
ReturnType: Promise<any>
or Observable<any>
or boolean
Function to be called on close button click. In case of Promise and Observable, modal dialog will not close unless successful resolve happens. In case of boolean, modal dialog will close only if result is truthful
.
actionButtons
Mandatory: false
Default: -
Type: Array<IModalDialogButton>
Footer action buttons for control of modal dialog. See IModalDialogButton.
Action buttons defined in child component have priority over action buttons defined via options.
data
Mandatory: false
Default: -
Type: -
Arbitrary data that will be passed to child component via dialogInit
method.
settings
Mandatory: false
Default: -
Type: IModalDialogSettings
Additional settings for granular configuration of modal dialog. See IModalDialogSettings.
interface IModalDialogButton {
text: string;
buttonClass?: string;
onAction?: () => Promise<any> | Observable<any> | boolean;
}
text
true
string
buttonClass
false
btn btn-primary
string
onAction()
false
function
Promise<any> | Observable<any> | boolean
truthful
.interface IModalDialogSettings {
overlayClass?: string;
modalClass?: string;
contentClass?: string;
headerClass?: string;
headerTitleClass?: string;
closeButtonClass?: string;
closeButtonTitle?: string;
bodyClass?: string;
footerClass?: string;
alertClass?: string;
alertDuration?: number;
buttonClass?: string;
notifyWithAlert?: boolean;
}
overlayClass
false
modal-backdrop fade show
string
modalClass
false
modal fade show
string
contentClass
false
modal-content
string
headerClass
false
modal-header
string
headerTitleClass
false
modal-title
string
closeButtonClass
false
close glyphicon glyphicon-remove
string
closeButtonTitle
false
CLOSE
string
bodyClass
false
modal-body
string
footerClass
false
modal-footer
string
alertClass
false
shake
string
alertDuration
false
250
number
buttonClass
false
btn btn-primary
string
notifyWithAlert
false
true
boolean
Licensed under MIT
FAQs
Dynamic modal dialog for Angular
The npm package ngx-modal-dialog receives a total of 517 weekly downloads. As such, ngx-modal-dialog popularity was classified as not popular.
We found that ngx-modal-dialog demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.